If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > first shell script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-25-04, 12:45
sjumma sjumma is offline
Registered User
 
Join Date: Oct 2003
Posts: 232
first shell script

I was writing my first script on vi editor

#!/bin/sh
echo hello
echo i am; 'whoami' ----without ';' it give out i am whoami so i put ;
me='whoami'
iam="i am $me"
echo $iam


when i run it
hello
i am
user
i am whoami---- i want this as ' i am user'

can anybody help !!!


thanks
__________________
bigfoots
Reply With Quote
  #2 (permalink)  
Old 09-25-04, 13:58
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
Code:
#!/bin/sh
echo hello
echo "i am `whoami`"
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #3 (permalink)  
Old 09-25-04, 17:17
sjumma sjumma is offline
Registered User
 
Join Date: Oct 2003
Posts: 232
echo "i am `whoami`"

does not work

" will make it as one work my main problem as i see it is 'whoami' is a new command

i should say
echo i am 'whoami'
__________________
bigfoots
Reply With Quote
  #4 (permalink)  
Old 09-25-04, 22:00
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
be sure to use back-quotes arounf whoami - NOT single quotes:
`whoami`
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #5 (permalink)  
Old 09-26-04, 09:23
sjumma sjumma is offline
Registered User
 
Join Date: Oct 2003
Posts: 232
yes i was using single quotes

thanks
__________________
bigfoots
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On