Tag Info

Hot answers tagged

5

You wrote in your last block, linux$ paste temp2 temp > temp2 You cannot do this. (Well you can, but it won't work.) What happens here is that the shell truncates temp2 ready to send output from the paste command. The paste temp2 temp command then runs - but by this stage temp2 is already zero length. What you can do instead is this, which uses a ...


2

It's easy to dynamically build the string and eval it: eval "$(echo -n 'pr -mt '; while read ext; do echo "<(ls -1 *.$ext)"; done < list |tr '\n' ' ' )" where list would be the file (possibly a fifo) representing the list of extensions you want to build the command from. <() essentially creates unnamed FIFOs. An eval-less alternative might be ...


1

If the first argument to the script is jobname and the second is command1 && command2 && command3 then the command you build up in the joined variable is something like command1 && command2 && command3>> /path/to/cron/log/dir/May_12_2015/jobname_2015-05-12_01-09-25.log 2>&1 You call eval on this string, and ...


1

Adding #!/bin/bash did the thing, I just forgot to add that line. Can't really tell, why it does not work on the shell, but somehow it now works inside the script and inside the cronjob. Thanks for the comments.



Only top voted, non community-wiki answers of a minimum length are eligible