18 Mayıs 2017 Perşembe

Bash script parameters

#!/bin/bash

# Note :

# "$*" All the positional parameters (as a single word) *
# "$@" All the positional parameters (as separate strings)

# Print out all the parameters
echo "Parameters -> $@";

# Print out number of parameters
echo "Number of parameters: $#";

# Print out all the parameters as a single word (include separete)
echo "Number of parameters: $*";

total=$(echo $#)

a=0

# Print all the parameters in loop
for i in $(seq 1 $total);do
        echo "$a . parametre ${@:$i:1}"
        a=$(($a+1))

done