what is $1 | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

what is $1

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-18-2008
glev2005 glev2005 is offline
Registered User
 
Join Date: Oct 2008
Last Activity: 19 July 2014, 10:56 PM EDT
Posts: 276
Thanks: 20
Thanked 6 Times in 6 Posts
what is $1

I see $1 in many scripts, can someone explain in the most simple terms useful, what does it mean/do please? It is never defined before, I read something like it's a conditional variable, help me out.. I want to be able to use it since it obviously is useful
Sponsored Links
    #2  
Old 11-18-2008
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 30 October 2014, 6:26 PM EDT
Location: Saskatchewan
Posts: 19,733
Thanks: 830
Thanked 3,373 Times in 3,160 Posts
$1 is the first commandline argument. If you run ./asdf.sh a b c d e, then $1 will be a, $2 will be b, etc. In shells with functions, $1 may serve as the first function parameter, and so forth.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes



All times are GMT -4. The time now is 05:07 AM.