BASH program output not functioning
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bash (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Hello
I have been battling this issue with BASH or w/e it is on this system. There are a lot of unexpected behaviours like ignoring -ux after #!/bin/bash -ux, I've had to "set -x". Also, I am unable to get the output from find to resolve as a variable in my loop which is effectively a running pipe. Back ticks and everything will not return output as I expect from BASH on Ubuntu 10 for example. Here is the script in its entirety:
### TOP OF SCRIPT ###
#!/bin/bash
DOCUMENT_
MIN_ARGS=1
NUMOFARGS=$#
INPUTFILE=$1
if [ "$NUMOFARGS" -lt "$MIN_ARGS" ]; then
echo "Missing file argument."
exit 1
fi
if [ ! -d "$DOCUMENT_DIR" ]; then
echo "Incorrect DOCUMENT DIR specified: $DOCUMENT_DIR"
exit 1
fi
if [ ! -f "$INPUTFILE" ]; then
echo "Incorrect file specified."
exit 1
fi
touch filesnotonFS.txt
cat /dev/null > filesnotonFS.txt
count=0
cat $INPUTFILE | while read filename; do
if [ $(find $DOCUMENT_DIR -name "$filename" | wc -l) -eq 0 ]; then
echo "$filename" >> filesnotonFS.txt
count=
echo "\n$count files found"
fi
done
### END OF SCRIPT ###
wrong package (dash is the Debian Almquist Shell, not the Bourne-Again Shell)