All,
I have a file (called, say, bundled_file.txt) of here docs stored in a directory, and the file looks like this:
cat > a.txt << 'eof'
...
...
...
'eof'
cat > b.txt << 'eof'
...
...
...
'eof'
cat > c.txt << 'eof'
...
...
...
'eof'
I want to un-bundle this file so that the files a.txt, b.txt, and c.txt get created in the same directory as the original bundled file above.
Normally, I would just cd
to this directory and run something like csh bundled_file.txt
, but I want to execute the csh
command while in my pwd (print working directory).
However, when doing a remote execution from my pwd, the files a.txt, b.txt, and c.txt get created there. I do not want this.
And, in case you're already thinking it, I do not want to change the files to say something like,
cat > /full/file/path/a.txt << 'eof'
...
...
...
'eof'
Any one who can help a novice out?
Thanks!
cd
to its own directory first. How to set current working directory to the directory of the script?