11 ms·
There are several simplifications of POSIX syntax; the syntax feels a bit like Tcl as a result. The most annoying differences are the missing/changed special v
by chalst 13y ago
There are several simplifications of POSIX syntax; the syntax feels a bit like Tcl as a result.
The most annoying differences are the missing/changed special variables: POSIX has special $@/$* to return parameters: you have to use arrays for these in fish. POSIX puts exit status in $? and fish in $status; also $$ becomes %self, and there is no convenient way to expand to the PPID. Also annoying is the absence of "||" and "&&" operators.
- jfb 13y agoYeah, it maintains just enough compatibility to be confusing. I'm not impressed; I'd like something more radical.
- jodrellblank 13y agoPowerShell for OS X/Linux? http://sourceforge.net/projects/pash/ http://sourceforge.net/projects/pash/
- oblio 13y agoExcept for the fact that it was last updated in 2008 :(
- LeafStorm 13y agoThat's because the syntax was redesigned to be more orthogonal. So $ is always followed by a word to expand a variable and not an arcane symbol, % is used for a wide variety of ways to get process ID's, and it's easy to set up arrays besides just $argv (plus if you do $argv on its own, it creates one word for every item in the array, without you having to worry about bizarre quoting). Most of these differences, and why they were made, are explained in the manual.
- deleted 13y ago[deleted]
- sagarm 13y agoThe equivalent to || and && are the commands "or" and "and.": $cmd1 && $cmd2 || $cmd3 becomes $cmd1; and $cmd2; or $cmd3; i.e., they're just commands that inspect $status and run their arguments.
- Someone 13y agoIs that truly equivalent? Consider: $cmd1 || $cmd2 `$cmd3` vs $cmd1; or $cmd2 `$cmd3` If 'or' is 'just a command', I would think the shell would evaluate $cmd3 before calling $cmd2. Or are 'and' and 'or' built-ins that are similar to Lisp special forms/Forth immediate words? Edit: decided I wasn't that lazy today, and looked it up in the documentation. "and" and "or" are built-ins (http://fishshell.com/docs/2.0/commands.html#and http://fishshell.com/docs/2.0/commands.html#and, http://fishshell.com/docs/2.0/commands.html#or http://fishshell.com/docs/2.0/commands.html#or)