Cory Klein

Pleasant Grove, UT

coryklein.com

Age: 30

Software engineer, frugality enthusiast

1d
awarded Popular Question
1d
awarded Nice Question
1d
comment Can Vim write incremental lines? i.e. on each line A becomes B, and 1 becomes 2
What version of vim will increment A to B with the Ctrl-a action? Mine definitely does not, and I'm on 7.4 1-1202.
2d
comment In Final Fantasy VII is there any way to save Aeris?
As the saying goes, "the only way to win is to not play." ;)
2d
accepted Provide default value if command returns with non-zero exit code
2d
comment Provide default value if command returns with non-zero exit code
Ah! I could pipe stderr to /dev/null and it works: cat config 2> /dev/null || echo 42.
2d
comment Provide default value if command returns with non-zero exit code
I'm not quite sure I understand how the trap logic would be combined with the cat config command from the example. Can you elaborate?
2d
comment Provide default value if command returns with non-zero exit code
The critical problem here is that it's the output of the commands that I care about. cat config gives an error cat: config: No such file or directory if config doesn't exist. So I end up getting the output of both commands instead of just the second one.
2d
comment Provide default value if command returns with non-zero exit code
Well... I could write a script that essentially does the same thing as above, but I was hoping that there was built-in bash syntax that supported this kind of a thing and I just hadn't learned about it yet. If no such bash syntax exists I guess the next best thing is a script, and the best script would be an elegant succinct one.
2d
comment Provide default value if command returns with non-zero exit code
This appears to work for the cat config example, but I was hoping for a solution that works regardless of whether the failure is due to a missing file. For example ./get_config_from_web.sh || echo 42.
2d
asked Provide default value if command returns with non-zero exit code
Feb
11
revised Disable -Wall compiler warnings in a Qt project?
deleted 13 characters in body
Feb
10
revised Disable -Wall compiler warnings in a Qt project?
deleted 45 characters in body
Feb
10
revised Make QLabel text selectable?
added 41 characters in body
Feb
10
comment Output path is shared between the same module error
@habitats I have seen the same thing. :/
Feb
9
awarded Popular Question
Feb
8
comment Make QLabel text selectable?
@Borzh Thanks for the info! I've added it to the answer.
Feb
8
revised Make QLabel text selectable?
added 99 characters in body
Feb
5
awarded Taxonomist
Feb
3
awarded Constituent
1 2 3 4 5