what is $1


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers what is $1
# 1  
Old 11-18-2008
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
# 2  
Old 11-18-2008
$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.
 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question