Argüman kullanımı

Temmuz 21, 2011 § Yorum yok § Kalıcı bağlantı

#!/usr/bin/env bash

echo name of script is $0
echo first argument is $1
echo second argument is $2
echo seventeenth argument is $17
echo number of arguments is $#

#!/usr/bin/env bash

for x in one two three four
do
echo number $x
done

output:
number one
number two
number three
number four

#!/usr/bin/env bash

for thing in "$@"
do
echo you typed ${thing}.
done

output:

$ allargs hello there you silly
you typed hello.
you typed there.
you typed you.
you typed silly.

Neredeyim ben!?

Linux Notları kategorisinde geziniyorsun.