Trying to skill up in Linux. I have written a bash script to google search from the terminal. It works adequately an I run it by typing

~/WHAT. So far so good. I can also run it using ./WHAT.

I then edit the bashrc file and add this at the end

alias < WHAT >='./WHAT'

But then when I run

source ~/.bashrc

I get the error

=./WHAT: No such file or directory

Where have have I gone wrong? Thanks in advance for your help!

  • 2
    Show us the text verbatim please: obfuscations like < THE ALIAS NAME > are unhelpful here – steeldriver Jul 17 '17 at 17:10
  • what is FILENAME and THE ALIAS NAME? I could help if you would describe these – Camden Jul 17 '17 at 17:14
  • 1
    IMHO your objective would be better achieved by placing your script somewhere like ~/bin and simply making sure that $HOME/bin is added to your PATH – steeldriver Jul 17 '17 at 17:20
  • Use the full path in bash scripts. ~ and ./ are ambiguous. Also, if you place the script in ~/bin you do not even need an alias as it will be in your path. – Panther Jul 17 '17 at 17:47

If you really added

alias < WHAT >='./WHAT'

you're misunderstanding Bash syntax. Read and re-read man bash. What you want is probably

alias WHAT='./WHAT'

but that's not what you want at all. See my answer over here

  • your link is hthttps:// should'nt it be https:// – Camden Jul 17 '17 at 17:24
  • 1
    @Camden Thank you very much. I fixed the typo. I must remember to test links before posting them. – waltinator Jul 17 '17 at 17:26
  • @crissixpaul Then please Accept my answer, so I can get more reputation points, and, eventually, Rule The World. TQ – waltinator Jul 17 '17 at 21:41

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.