Putting Script Names In Shell Scripts
Hi~
I am new here, in fact this is my first post. I am working on a shell script for class and the instructions are: After a blank line display the text "Running the nameofscripthere shell script as user yourloginidhere" Here's what I have so far: echo echo "Running the shell script as user $HOME" What comes out is: Running the shell script as /student/curleram How do I get my script name in the the sentence? Thank you so much in advance :) |
Welcome to LQ! :) But part of the rules are not to ask homework related questions. I will say that you can find the answer to the first part early on in the bash manual ('man bash') and that you need to look into backticks and 'whoami' as one route to be more precise on the second part. ;)
|
OOPS! Sorry, won't happen again, but thanks for the hint.
|
For "nameofscripthere" you will find the answer in the bash manual.
$HOME is not "yourloginidhere". Your techer expects "curleram" instead of "/student/curleram". Use the "env" command to show all available environment variables. |
Thank you very much. I used the $USER enviroment variable.
|
All times are GMT -5. The time now is 10:49 PM. |