Home » » Shell Scripting Tutorial For Beginners Four - Snuff It Arguments To A Bash-Script

Shell Scripting Tutorial For Beginners Four - Snuff It Arguments To A Bash-Script





#! /bin/bash  # $* Returns a unmarried string (``$1, $2 ... $n'')  # comprising all of the positional parameters # separated past times the internal plain separator graphic symbol  #(defined past times the IFS surroundings variable). # $0 Refers to the refer of the script itself echo $0 $1 $2 $3  ' > echo $1 $2 $3'  # $@ Returns a sequence of strings  # (``$1'', ``$2'', ... ``$n'') # wherein each positional parameter  # remains variety from the others. args=("$@")  echo ${args[0]} ${args[1]} ${args[2]}   echo $@  # $# Refers to the lay out of arguments  # specified on a ascendence line. echo $# 
output:


test@test$ ./hello.sh Mark Tom John ./hello.sh Mark Tom John  > echo $1 $2 $3 Mark Tom John Mark Tom John 3 

0 comments:

Post a Comment

Search

Blog Archive