How do I read a glob in Bash from command line? I tried this and it only picks up the first file in the glob:
#!/bin/bash
shopt -s nullglob
FILES=$1
for f in
The reason it reads only the first file, is that the pattern /home/hss/* gets expanded before it is passed as an argument to your script. So your script does not see it as a pattern, but as a list of files, matching that glob.
So, you need to call it like eugene y specified in his post:
sh script.sh "/home/hss/*" 4 gz
The quoting of $1 looks optional to me. It just makes the pattern to expand in for cycle rather than in assignment.