Search code examples
linuxbashunixkeyboardqsub

Encoding Keyboard Command Onto Bash Script


I have the following way to submit a job with cluster using qsub:

 Submitting jobs from standard input
       To submit a PBS job by typing job specifications at the command line, the user types

              qsub [options] <return>

       then types any directives, then any tasks, followed by

              (in UNIX)     CTRL-D on a line by itself
              (in Windows)  CTRL-Z <return>

       to terminate the input.

Is there a way we can encode RETURN and CTRL-D in bash script so that we can do something like:

for i in path/*.txt; do echo "$i";  qsub [RETURN] /path2/mycode $i; [CTRL-D]; done

Solution

  • You should use redirection through pipes:

    for i in path/*.txt; do
      echo "$i";
      echo "/path2/mycode $i" | qsub;
    done