Reputation: 14218
I want to append a line to another file from within my bash script:
#!/bin/bash
echo "xxx" >> ~/.bashrc
However I get:
bash: xxx: command not found
Upvotes: 0
Views: 1775
Reputation: 72639
Could be it already worked, now you have an xxx
command a the end of your ~/.bashrc
and the next time it (bash) is invoked, it runs your .bashrc
but can't find xxx
. Is there an xxx
command in your PATH
?
Upvotes: 0
Reputation: 51603
Try it (the echo "xxx" >>
part) from the CLI. It is likely caused by an improper file format (e.g. wrong encoding and/or windows line endings.
Also cat -a SCRIPTNAME
might give some insight.
Upvotes: 1