Why am I unable to have the output to a file, dir_, from shell script ?
Here is the command in script:
userid]# vi script.sh
#! /bin/bash echo `grep -w 7171 $ABC` > /home/username/dir/dir_$(date +%Y%m%d_%H%M%S).csv
userid]# ./script.sh ./script.sh: line 13: /home/username/dir/dir_20141201_160840.csv: No such file or directory
Well I expected the script to create a new file.
Please advise the workaround.
Regards, Ashish
/home/username/direxist? Also thatechois entirely unnecessary and actively causes issues with spaces in thegrepresults.grep -w 7171 "$ABC" > ...there's literally no need forechothere./home/username/direxists then you should check permissions on it but I would expect a different error from that scenario in most cases.grep -w 7171 "$ABC" >WHERE $ABC is a file name, it throws an ERROR:grep: : No such file or directory