You are not logged in.
Hello,
I'm running this script:
cat "" > $LOG_DUMP/FPGA_log.txt
echo "$RESULTS" >| $LOG_DUMP/FPGA_log.txt
And this is what I'm getting:
...
hl_script.sh: line 109: logs/2014_04_30_14_41_49/FPGA_log.txt: No such file or directory
hl_script.sh: line 111: logs/2014_04_30_14_41_49/FPGA_log.txt: No such file or directory
...
The thing about this path is that I _know_ that it exists and I'm trying to create the FPGA_log.txt file (note: I've tried touch, but got the same error.)
Last edited by publicus (2014-04-30 19:07:09)
Offline
Try setting $LOG_DUMP to an absolute path
Offline
I don't understand why you're catting an empty string to the file to create it nor have I ever seen ">|" before. Try this instead
mkdir -p "$LOG_DUMP"
echo "$RESULTS" > "$LOG_DUMP/FPGA_log.txt"
Also note that you are not using absolute paths so the paths will be relative to the directory where the script is run. Perhaps it is not trying to write to the file you intend. To check the path, use
readlink -f "$LOG_DUMP"
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Xyne, you're right. I was in the wrong path all along. I didn't prefix the path where I was supposed to be correctly, hence the errors.
All fixed now.
Offline
I don't understand why you're catting an empty string to the file to create it nor have I ever seen ">|" before.
'>|' is a zsh/ksh-ism
>| word
Same as >, except that the file is truncated to zero length if it exists, even if CLOBBER is unset.
Offline
Xyne wrote:I don't understand why you're catting an empty string to the file to create it nor have I ever seen ">|" before.
'>|' is a zsh/ksh-ism
>| word
Same as >, except that the file is truncated to zero length if it exists, even if CLOBBER is unset.
Yes, I have the clobber setting turned on (and it still works on machines without the clobber setting turned on.)
Offline
Thanks for the clarification of ">|".
When redirecting data to a file with ">", is the file not always truncated to the length of the redirected content in zsh/ksh? This seems to be the case in bash. If not, does it just overwrite data at the beginning of the file?
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Thanks for the clarification of ">|".
When redirecting data to a file with ">", is the file not always truncated to the length of the redirected content in zsh/ksh? This seems to be the case in bash. If not, does it just overwrite data at the beginning of the file?
Based on my exprience with bash and zsh, it just nukes the file contents, just like >. However, the task is less likely to be done by human error when >> was expected and inadvertedly blowing your original away.
Offline