I have been trying to use nohup with bash for loop and I came across this post here which was helpful and gave me an idea but my command is still not working properly. What I have right now looks like:
nohup sh -c 'for i in {0..9}; do spark-submit --class some.Code /some/Jar.jar --input_path /some/path/part-001"$i"* > test_log.log; done' &
when I run this the job fails with the following exception that the input path does not exists and shows me the path as:
/some/path/part-001{0..9}*
How can I get this to replace $i
with the actual value of i and not the string {0..9}
?
Thanks
IMHO sh is not an alias of bash on your system. If you start it like this:
nohup bash -c 'for i in {0..9}; do spark-submit --class some.Code /some/Jar.jar --input_path /some/path/part-001"$i"* > test_log.log; done' &
it will get working. As far as I can remember, the used syntax is the bash's own.
Ps: but I'm not sure, if the " marks around $i are needed. I prefer ${i} form.
Edit: if on your system sh is an alias of dash, then you could use this:
nohup sh -c 'for i in `seq 0 9`; do spark-submit --class some.Code /some/Jar.jar --input_path /some/path/part-001"$i"* > test_log.log; done &'