I am trying to append some config to another file like this
sudo cat config/add-this.yml >> ~/docker-compose.yml
via shell script. But trying this gives me a
Permission denied error.
How can I simply append some content to another file?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
The problem is that the shell performs redirections before the command is executed.
In this case. unless the permissions of the file into which data is to be added allow appending, a permission denied error results.
You can circumvent this by doing:
sudo sh -c 'cat config/add-this.yml >> ~/docker-compose.yml'