Attica command line project

https://www.codecademy.com/paths/web-development/tracks/learn-the-command-line/modules/learn-the-command-line-environment/projects/attica

I could use some help with step 10.
we’re supposed to export a user within the bash profile but when I add my name to the command nothing gets spit out after i save the file and try to echo it on the command line.

I’ve used, export $USER=“FIrstName LastName”

after ctrl+o , enter, ctrl+x

$echo $USER
blank

insight into this issue would be appreciated. Thank you!

I solved my own problem. After reworking the excercise I re-learned that when you are implementing a command within the bash profile via nano, one must not include the ‘$’ before the word USER.

Only use the ‘$’ when echoing the code outside of the file within the command line.

So,

$nano ~/.bash_profile
$export USER=“FIrstName LastName”
Ctrl+O, enter, Ctrl+x,
$echo $USER
FirstName LastName // Printed to the command line

1 Like

Seems like you’ve already got it, kudos. For anyone else it’s for when you want to dereference the currently stored value, e.g. store a variable then use the string value with a command

name='Bingo'
echo "name"
name
echo "$name"
Bingo

If you don’t use the shell often you still might see this (or something using slightly more advanced expansion) used inside scripts for simple things like modifying the PATH since you want both the current value of PATH (accessed with $PATH) and your new string to append.

2 Likes