Unix/Linux Go Back    


UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers

what is $1

UNIX for Dummies Questions & Answers


 
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 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 Unix and Linux 11-18-2008
Corona688 Corona688 is online now Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 2 December 2016, 2:39 PM EST
Location: Saskatchewan
Posts: 21,657
Thanks: 1,008
Thanked 3,979 Times in 3,696 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
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes



All times are GMT -4. The time now is 03:49 PM.