0

I've written a line in .bashrc

alias untar='sudo tar –xvzf'

Now, when I use "untar" in bash I get the error:

untar filename.tar.gz

tar: invalid option -- '�' Try 'tar --help' or 'tar --usage' for more information.

However when I use the actual command instead of the alias

sudo tar –xvzf filename.tar.gz

It works fine.

I did run . ~/.bashrc, so the alias is "known" (or however you'd call it). Which is also evident form the error message which acknowledges it's a tar command. There's other aliases in bashrc which still work fine.

So, why isn't my alias working?

1 Answers1

4

Your alias has a bad character, not the standard ASCII symbol (minus sign) but another one, which by some fonts is rendered as a longer dash.

This alias works for me

alias untar='sudo tar -xvf'

$ printf '-'|hexdump -C
00000000  2d                                                |-|
00000001
$ printf '–'|hexdump -C
00000000  e2 80 93                                          |...|
00000003
sudodus
  • 47,684