what does $l means in a shell script (148 Views)
Reply
Regular Advisor
MSwift
Posts: 146
Registered: ‎01-23-2009
Message 1 of 6 (148 Views)
Accepted Solution

what does $l means in a shell script

I wanted to know what does a $l (lower case L) means in a unix shell script?

Thanks

MSwift
Please use plain text.
Honored Contributor
Patrick Wallek
Posts: 13,731
Registered: ‎06-21-2000
Message 2 of 6 (148 Views)

Re: what does $l means in a shell script

In what context?

A $l (lower case L) is probably just a variable of some sort. It has no special meaning to the shell.

If it is actually a $1 (the number 1), then that means the first argument on the from the execution of the script.

For example, if you execute:

# myscript.sh me too

Then $1=me and $2=too.

Please use plain text.
Honored Contributor
Viktor Balogh
Posts: 1,007
Registered: ‎03-15-2009
Message 3 of 6 (148 Views)

Re: what does $l means in a shell script

Hello MSwift,

Most likely it is a shell variable (as , but it can depend from the context. With the dollar sign you can query the value of the variable like this:

# l=test
# echo $l
test
#

****
Unix operates with beer.
Please use plain text.
Honored Contributor
Sajjad Sahir
Posts: 1,277
Registered: ‎12-07-2007
Message 4 of 6 (148 Views)

Re: what does $l means in a shell script


Dear Mswift

when u execute a shell program, u can include parametes on the command line. when u do, each parameters must be separated with bland like.

scopy saj1 saj2 saj3

where scopy is a shell program with three parameters

when the shell program runs, u can access the value of these parameters with positional parameters $0,$1, $2 etc..

and $1 is equl to saj1
$2 is equal to saj2
$3 is eqaul to saj3

and $0 is always the command name
here it is scopy.

thanks and regards

Sajjad Sahir
Please use plain text.
Honored Contributor
dirk dierickx
Posts: 958
Registered: ‎12-20-1999
Message 5 of 6 (148 Views)

Re: what does $l means in a shell script

by adding '-x' and running your script you can see what it does, using this method you can find out what gets assigned to $l and when.

unless it would be $1 in which case it got explained already by the others.

if it is $1 i suggest you use another font for your terminal so to not make this mistake in the future.
Please use plain text.
Honored Contributor
Suraj K Sankari
Posts: 1,659
Registered: ‎09-09-2008
Message 6 of 6 (148 Views)

Re: what does $l means in a shell script

Hi,
>>I wanted to know what does a $l (lower case L) means in a unix shell script?

Its depending upon your script can you post your script then we can be able to tell the meaning of your $l.

how you can use this see this below example
l=10
echo $l
10

suraj
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation