1

I am creating alias in .bash_aliases file in Ubuntu 14.04 with reference of this article

I write these

alias agi='sudo apt-get install'
alias upd8='sudo apt-get update'
alias perms='stat -c '%a - %n'
alias dwld='cd ~/Downloads'
alias ..='cd ..'
alias la='ls -alh'
alias hf='history | grep $1'
alias pf='ps -e | grep $1'

I close the terminal and file and start the terminal it always gives error.

bash: /home/ice/.bash_aliases: line 8: unexpected EOF while looking for matching `''
bash: /home/ice/.bash_aliases: line 9: syntax error: unexpected end of file

Please note there is not a line 9, no white space, no special character

What I have done so far

  • Removed white space new line and space between lines.

  • Remove last two lines but then error comes on last and next to last line ( 6 & 7)

  • Deleted the temp file on same folder ending with ~ but error remains.

  • Removed the .. and la alias line ( may be it can cause issue) but error still remains.

  • I have created an alias with perms from terminal before the creation of .bash_aliases so removed that alias using unalias perms

  • check all alias using alias and it show only first 2 alias andd interestingly first two aliases are working fine.

Is this some kind of bugs or what?

  • So what's the new problem? Did you start a new shell? – muru Nov 15 '14 at 8:12
  • @muru it was the quotes error as you answered. Thanks for the quick response. I just addded two more action what I did. – diEcho Nov 15 '14 at 8:14
2

The syntax highlighting that Stack Exchange offers is enough to see what's wrong. It's this line:

alias perms='stat -c '%a - %n'

The quote isn't closed. Try:

alias perms='stat -c "%a - %n"'
  • Thanks :). I also seen the highlighted syntax, it's just superb. You save my day – diEcho Nov 15 '14 at 8:15

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.