Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-16-2003, 04:13 PM   #1
LQ Newbie
Registered: Dec 2003
Location: Wisconsin
Posts: 3

Rep: Reputation: 0
Putting Script Names In Shell Scripts


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 "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
Old 12-16-2003, 04:29 PM   #2
Senior Member
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
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.
Old 12-16-2003, 06:27 PM   #3
LQ Newbie
Registered: Dec 2003
Location: Wisconsin
Posts: 3

Original Poster
Rep: Reputation: 0
OOPS! Sorry, won't happen again, but thanks for the hint.
Old 12-17-2003, 06:57 PM   #4
LQ Newbie
Registered: Dec 2003
Distribution: Mdk 9.2
Posts: 9

Rep: Reputation: 0
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.
Old 12-17-2003, 11:16 PM   #5
LQ Newbie
Registered: Dec 2003
Location: Wisconsin
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you very much. I used the $USER enviroment variable.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 06:32 PM
bash:output file names from shell script to vi sickboy Linux - Newbie 6 10-14-2004 04:40 AM
how to execute shell scripts from cgi script rajatgarg Linux - General 1 07-08-2004 02:39 PM
putting shell script accessible in all directory demmylls Linux - General 1 02-23-2004 11:37 AM
i need to know the names of the scripts! Jeffrey Linux - General 1 03-07-2001 10:52 PM > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration