LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Putting Script Names In Shell Scripts (https://www.linuxquestions.org/questions/linux-newbie-8/putting-script-names-in-shell-scripts-126414/)

sayble96 12-16-2003 03:13 PM

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 :)

slakmagik 12-16-2003 03:29 PM

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. ;)

sayble96 12-16-2003 05:27 PM

OOPS! Sorry, won't happen again, but thanks for the hint.

dolmen 12-17-2003 05:57 PM

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.

sayble96 12-17-2003 10:16 PM

Thank you very much. I used the $USER enviroment variable.


All times are GMT -5. The time now is 10:49 PM.