I aliased the following script:
#!/usr/bin/bash
if [[ -d "template.html" ]]; then
:
else
cp -n /home/$(whoami)/CS/Software/Pollen/template.html .
fi
/usr/bin/echo "#lang pollen
[1]: " > ${1}.html.pmd
with alias tmd="~/CS/Software/Bash/create_md.sh"
in my .bashrc
.
The script does its job of creating a file in the current directory but it fails to create a file in a distant directory, I get from Bash: bash: /home/jim/CS/Software/Bash/create_md.sh: No such file or directory
. Quoting, i.e. "${1}.html.pmd"
, has not resolved the matter. Yet echo
typed in manually, e.g. echo "ana-echo">ana1/ana2/file.html.pmd
does such job. Why is it so?
How might I improve on the script (so that it does the job in distant directories
as well)?
tmd ana1/ana2/file
whereana1/ana2/
are the directories of the relative path to the file to be created . The error message isbash: /home/jim/CS/Software/Bash/create_md.sh: No such file or directory
#!
on the first line of your script is funny.