I am trying to create a bash file which will modify some files but I have a problem with one command.
When I use sudo echo "$HTTP["url"]" >> file.conf
I get error permission denied.
What I actually want is the file to have $HTTP["url"]
inside, the $HTTP is not a variable in bash its just text.
Asked
Active
Viewed 855 times
0

cptsianios
- 15
- 4
-
1To make it plain text use `'$HTTP["url"]'`, but I don't know what causes permission denied. – a5hk Jun 01 '14 at 09:57
-
1possible duplicate of [How do I use sudo to redirect output to a location I don't have permission to write to?](http://stackoverflow.com/questions/82256/how-do-i-use-sudo-to-redirect-output-to-a-location-i-dont-have-permission-to-wr) – user000001 Jun 01 '14 at 10:15
1 Answers
1
If you put it inside of single quotes, it should work
echo '$HTTP["url"]'

Jonathan Wheeler
- 2,539
- 1
- 19
- 29