-
Notifications
You must be signed in to change notification settings - Fork 1
eval_cmd
Ekarin Eric Pongpipat edited this page Sep 12, 2024
·
1 revision
Function to evaluate a string command with some extra checks and options
eval_cmd -c "${cmd}" -o /path/to/output.txt
Note: The command must be wrapped in quotes
You can specify more than one output file to be checked if they exist before running. If any of the output files exist, it will skip evaluating the command. After evaluating the command, the function will ensure that each output file exists and will error if they do not.
eval_cmd -c "${cmd}" -o /path/to/output1.txt -o /path/to/output2.txt
By default, if one of the output files exists, it will not run unless the overwrite flag is used.
eval_cmd -c "${cmd}" -o /path/to/output.txt --overwrite 1
You can also print the command without evaluating it, which is useful for debugging
eval_cmd -c "${cmd}" -o /path/to/output.txt --print 1