I want know weather it is possible to pass arguments from command line and from the function inside a shell script
I know its is possible to pass a argument from command line to shell script using
$1 $2 ..
But my problem is my shell script needs to accept arguments from the command line as well as the function inside the shell script .
find my shell script below
#!/bin/bash
extractZipFiles(){
sudo unzip "$4" -d "$5"
if [ "$?" -eq 0 ]
then
echo "==>> Files extracted"
return 0
else
echo "==>> Files extraction failed"
echo "$?"
fi
}
coreExtraction(){
extractZipFiles some/location some/other/location
}
coreExtraction
echo "====> $1"
echo "====> $2"
echo "====> $3"
echo "====> $4"
echo "====> $5"
I execute my shell script by passing
sudo sh test.sh firstargument secondargument thirdargument