Timeline for choose between one of two programs in bash script
Current License: CC BY-SA 3.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 23, 2017 at 11:33 | history | edited | CommunityBot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
| Aug 20, 2015 at 4:21 | vote | accept | hilcharge | ||
| Aug 13, 2015 at 8:00 | comment | added | FelixJN |
does OpenBSD have the uname command? If so you could use this output and check which system you are working on at the very beginning: if [ "$(uname -a)" == "Linux" ] ; then linux=true ; else linux=false ; fi. Or a case selection for defining the OS. Note that since BASH does not have boolean variables, future checks must be if [ "$linux" == "true" ].
|
|
| Aug 13, 2015 at 3:57 | answer | added | hilcharge | timeline score: 3 | |
| Aug 13, 2015 at 2:48 | comment | added | yaegashi |
for $OPT in ... won't work, remove $. And it's superfluous to use $? just for checking success/failure, simply write if command -v "$OPT"; then.
|
|
| Aug 13, 2015 at 2:43 | comment | added | larsks | I don't believe openssl provides such an option. | |
| Aug 13, 2015 at 2:34 | comment | added | hilcharge |
openssl sha256 looks good for generating the hash. Is there a related way to check a file with the hashes listed in it. I.e. equivalent to sha256 -c FILE?
|
|
| Aug 13, 2015 at 2:29 | comment | added | hilcharge | I realized after writing this question, this question may be better suited for stack overflow. Should I move it? | |
| Aug 13, 2015 at 2:27 | comment | added | larsks |
If both platforms have openssl installed, you can just use openssl sha256 in both places and not worry about picking an os-specific program.
|
|
| Aug 13, 2015 at 2:18 | history | asked | hilcharge | CC BY-SA 3.0 |