I am trying to pass a text file as a specific argument and print its name and content...
#!/bin/bash
## set input args
while getopts "f" option; do
case "${option}" in
f)
arg3=${OPTARG};;
esac
done
## script
echo $arg3
echo $(cat $arg3)
(for running it: sh myscript.sh -f filelist
)
Something is really wrong because even the file name is not appearing! (and curiously, in bash everything goes well, why?).