BASH program output not functioning

Bug #1100871 reported by Brodey Dover
6
This bug affects 1 person
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_DIR=/var/lib/tomcat6/webapps/OscarDocument/
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=$((count+1))
  echo "\n$count files found"
 fi
done
### END OF SCRIPT ###

Revision history for this message
Richard Hansen (rhansen) wrote :

wrong package (dash is the Debian Almquist Shell, not the Bourne-Again Shell)

affects: dash (Ubuntu) → bash (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.