3 ms·
Despite how great it is, the need of escaping ? and & characters or using quotes is very annoying...
by hanula 13y ago
Despite how great it is, the need of escaping ? and & characters or using quotes is very annoying...
- chalst 13y agoHow is this different from POSIX sh?
- hanula 13y agoSimple case: working with URLs. curl -I https://news.ycombinator.com/item?id=5723235 https://news.ycombinator.com/item?id=5723235 works in sh and bash, doesn't in fish.
- GlitchMr 13y agoThis is a feature. See https://github.com/fish-shell/fish-shell/issues/683 https://github.com/fish-shell/fish-shell/issues/683. It appears to work in bash, but only because globs simply write themselves if they won't find anything. The behavior is misleading. But also having to escape ? is somewhat annoying. Also, URLs with & don't work in bash anyway. Or rather, they will work, but do something you wouldn't expect - it would ignore & and everything after it, and run command in the background. Please note that zsh works similarly to fish. Well, mostly. It seems that zsh has special logic that automatically inserts backslash before ? if it detects an URL. Perhaps that could be implemented in fish. But it also feels somewhat magical. Why "\?" would appear when I type "?"? But perhaps it's the best way. In your case, it's possible to break it. But the break looks really contrived, so perhaps zsh behavior would be safe. [glitchmr@pineapple tmp]$ mkdir -p https://news.ycombinator.com [glitchmr@pineapple tmp]$ touch https://news.ycombinator.com/itemsid=5723235 [glitchmr@pineapple tmp]$ wget https://news.ycombinator.com/item?id=5723235 --2013-05-17 13:39:09-- https://news.ycombinator.com/itemsid=5723235 Resolving news.ycombinator.com (news.ycombinator.com)... 184.172.10.74 Connecting to news.ycombinator.com (news.ycombinator.com)|184.172.10.74|:443... connected. HTTP request sent, awaiting response... 404 Not Found 2013-05-17 13:39:10 ERROR 404: Not Found.
- hanula 13y agoRight, makes perfect sense of course as the standard goes. Sometimes just wish URLs were handled in special way in shells. Fish isn't compatible with bash, couldn't it go step further? Some magic isn't always bad...
- ksherlock 13y agoYou give bash more credit than it deserves. `wget url?a=1&b=2` is parsed as`wget url?a=1 & ; b=2` ie, it runs `wget url?a=1` in the background and sets the shell variable b=2.
- deleted 13y ago[deleted]