When I type command echo 'cd ~/Development/Web' > /usr/local/bin/webdev, my goal is create file webdev in /usr/local/bin, I get error 'Permission denied', then change command to 'echo 'cd ~/Development/Web' > sudo /usr/local/bin/webdev', command runs successfully my expection is that created file webdev in /usr/local/bin, but instead is create sudo file in ~. How I can run my first command, without sudo su and then echo 'cd ~Devel...?

  • What do you actually want to do? – Kusalananda Mar 13 '18 at 13:25
  • @Kusalananda, updated question. – Ramzan Chasygov Mar 13 '18 at 13:33

Try this :

echo 'cd ~/Development/Web' | sudo tee /usr/local/bin/webdev
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.