Tag Info

New answers tagged

7

By default, watch runs your command with /bin/sh -c '...' so the output you see is how /bin/sh interprets the time command. Your /bin/sh apparently doesn't have a builtin time. To run the command with a different shell, use the -x option to get rid of the default, then add your own explicit invocation of the shell whose builtin you want. watch -x bash -c ...


1

POSIX POSIX only accepts the = and != operators (inside [, test ), to compare strings. POSIX accepts the < and > operators (inside (( ), to compare integers. POSIX does not define any use to compare strings of > and < in test. The answer as to why two shell defined operators < and > fail to work, or how they should work is outside ...


2

Just use: cd -P .. From the bash manpage: The -P option says to use the physical directory structure instead of following symbolic links.


4

POSIX only defined = operator for test, for checking two strings are identical. < and > are shell redirection, and aren't comparison operators inside old test [. In shell support new test [[, < and > compare two strings using current locale. With those things in mind, we can explain your question. In: if [ "4" > "a" ]; then echo "yes 1"; ...


-1

> and < are input redirection operators in bash, not numerical operators. Doing man test shows the available operators, which for numerical less than and greater than should be -lt and -gt respectively.



Top 50 recent answers are included