Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is this behaviour documented anywhere? The closest I can find is https://www.gnu.org/software/bash/manual/bashref.html#Aliase... which remarks,

> The first word of each simple command, if unquoted, is checked to see if it has an alias.

I observe that t\ime works just as well as \time.



Just quoting it normally also works, apparently, as your excerpt from the man page suggests:

  $ help|head -1
  GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)
  $ "time" --version
  GNU time 1.7
  $ time --version
  bash: --version: command not found
  
  real	0m0.001s
  user	0m0.000s
  sys	0m0.000s


t\ime is rather surprising. Is there any documentation or explanation on why it does what it does?


https://www.gnu.org/software/bash/manual/bashref.html#Escape...

I think it's because using the backslash to escape counts as quoting. So the following are all equivalent:

  $ \time foo
  $ t\ime foo
  $ 'time' foo




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: