I have written a Bash script in a directory. When I run it and then run 'ls' a number appears in the directory level which I must then use 'rm' to get rid of.
This Bash script is meant to save the current files in the directory to
logstore.txt then get the old number of lines stored in
numlines.txt then find the new number of lines assigning this to
numlines.txt and finally getting the new number of lines to compare to the old number (the server is adding new files over time if you couldn't guess) I then run a comparison between the old and new line lengths.
Here is the code in a .sh file.
ls /home/vcm > /home/vcm/logstore.txt oldnumlines=$(cat /home/vcm/numlines.txt) #log store takes the new ls of items and stores it as num lines after the old v$ cat logstore.txt | wc -l > /home/vcm/numlines.txt newnumlines=$(cat /home/vcm/numlines.txt) if [ ! "$newnumlines" > "$oldnumlines" ] #[ "$a" -eq "$b" ] #(( "$newnumlines" -le "$oldnumlines" )) then *do something* fi
Why is this script creating new variables in the directory?