3 ms·
If you can't recall the syntax 3 days later it's terrible. Same applies to awk, sed and the like. No matter how many times I used them for something, I always h
by lofaszvanitt 3y ago
If you can't recall the syntax 3 days later it's terrible. Same applies to awk, sed and the like. No matter how many times I used them for something, I always have to resort to the documentation, chatgpt or the like because I just can't remember the contrived syntax. Maybe I'm retarded somehow... ¯\_(ツ)_/¯
Python (dead simple, easy to recall):
if monkey == 'fat':
print('happy')
vs. bash (horrible syntax pitfalls):
if [ "$monkey" = 'fat' ]; then
echo 'happy'
fi
you gonna forget about the semicolon, the spaces around the condition and it will error out. not to mention integer comparison operators...
python also has some terrible syntax, but those are advanced things, like list comprehensions.
jq...it's the same as awk, sed, bash... hard to remember for the reasons mentioned above
- Izkata 3y agoAside, your post looks funny because 2-space indentation triggers code formatting (so only the body of those if statements are formatted as such, instead of the whole thing).
- wwader 3y agoI think it's quite nice and intuitive to describe a pipe of filters as: filter | filter | filter. Also note that a single filter in jq is 1:N, 1 input N output where N can be zero which is a very useful feature. To express this in python etc you would probably need nested for i in (for j in ...)) and/or also use nested yield from somehow which results in a note a very CLI/ad-hoc query friendly syntax