set -xv is not error checking, but debugging. That means the shell will print a lot of information about what's happening. But that will not check anything for you. Instead, you need to check yourself if the program flow is what you expected or not.
Again you did not post what you really tried therefore noone will tell you what's wrong with that. Additionally if you post an output produced using set -xv we can go through to understand line by line. |
Current script is attached; output of ...
1 Attachment(s)
...running the script with set -xv (line 2) and ls dummy (right after) looks like:
Code:
farragut/public $ autotouch $picc Code:
[[ -f "dummy" ]] && rm -f dummy Carver |
Quote:
Code:
$ ./autotouch.sh words.txt Quote:
|
1 Attachment(s)
Quote:
And I did not get the error you did when you ran "autotouch." I must have fixed it after posting and thus the non-working version was prone to err out. Here's the (error-free) version of the script as it ran today: Code:
#!/bin/bash Carver |
Quote:
|
Quote:
Code:
rm -f dummy Code:
[scasey:~]$ rm dummy |
Quote:
From the bash manpage: Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ANSI C standard.and A double-quoted string preceded by a dollar sign ($"string") will cause the string to be translated according to the current locale. If the current locale is C or POSIX, the dollar sign is ignored.Presumably, the first is what you wanted, though <newline> and <backspace> are a rather odd combination for field separators. |
Quote:
Quote:
Code:
which autotouch |
Following latest advice...
...I made these changes to the body of the script (leave off, for the moment, my IFS declaration.):
Code:
rm -f dummy Carver |
single quotes '/n/b' work, but...
...the commands to delete dummy are still ignored, as is, it appears, the set -xv command.
I copied the script with the name 'autodate,' and set -xv works fine in it. Carver |
Quote:
set -xv works always, if used, that will not influence the program flow anyway but print the lines as they executed. You need to check if there was any error message. |
Quote:
Each script has one or two parts that "don't work," and I've been trying to figure out why. I'm trying to remove the 'old' file dummy in anticipation of situations where I may want to change the mod date of a file but noclobber IS set. I would like to set it on my own system at some point and still have this/these script/s work. If there's a 'touch' command that creates a new file dummy every time either the first or second script is executed, that won't fly. Carver |
so it looks like you execute different files (not the one you posted), execute something with different names or in different directories and checks something, but you never tell us what was really executed, what's happened exactly and what was expected. Please post exactly the full script you executed, the full output generated (exactly) and do not try to cut/explain modify them, just post as it is.
Otherwise it looks completely pointless (at least for me) |
What color is the egg on my face now?
Quote:
The ways I execute (consistently from the time I wrote the first version of this script to the date I'm writing this reply) have either been Code:
autotouch $picc Code:
autotouch foo.jpg Code:
function autotouch () { Carver |
Quote:
Code:
touch dummy Quote:
|
All times are GMT -5. The time now is 08:03 PM. |