bash script suddenly stopped working
Code:
#!/bin/bash -i I ran Shellcheck on it, corrected a few things it pointed out, and it still gives the error. I suppose Shellcheck doesn;t check for what will work with touch -t in all circumstances. I'd RTFM, except i find the GNU man-page less than fully informative (haven't read the coreutils info part in a long while, though). Carver |
Have you tried adding
Code:
echo "$dart" And/or show us what you're passing to the script to populate picc |
Code:
IFS=$"\n\b" Code:
IFS=$'\n\b' Reference: ANSI-C Quoting Locale-Specific Translation |
Quote:
Code:
IFS=$"\n\b" Carver |
One is there, the other is unclear.
Quote:
And picc is usually it's the name of a JPEG file, such as 310_1000.jpg. Carver |
Quote:
|
NPAA
Quote:
Side topic: an irony is that the "touch is now broken" script is the one I asked for trimming-down advice here. Carver |
Quote:
|
You'll hate what just happened.
I ran the script, commenting out any "exit0's" I was using to test where the date variable values go missing, and it did not return a touch error.
Here is the script I ran: Code:
#!/bin/bash -i So the thing that makes me want to scratch my head is: why did it suddenly start working again? Carver |
Quote:
But you forgot to explain what did you modify exactly, so noone can tell you exactly why. |
A working script now, but another annoyance has cropped up
1 Attachment(s)
Code:
#!/bin/bash -i Carver |
did you try set -xv? did you check if rm/shred was really executed?
Again you did not post what you really tried the -i in the first line is definitely not required. |
Quote:
See the edited script above...I commented out (and highlighted) the lines I'm saying are not needed to accomplish the task and added one new line. This will have the effect of setting the timestamp on the file named in $picc to "now", which is what the original script is doing [I'm unable to test this, however, and leave it to the OP to try it out]. Needless to say, that makes the last concern about removing the file dummy moot. |
Don't take the answer beyond the scope of the question, please.
Quote:
I simply wanted to know why the script was not creating, using, then deleting the dummy file when I instructed it to. I hardly expected a re-analysis of the whole script. I said it worked to my satisfaction except for this one small new issue, which I thought was a glitch in my coding, and still think so. Carver |
Quote:
Code:
autotouch foo.jpg && nodummy Carver |
All times are GMT -5. The time now is 07:07 AM. |