-3

I have a bunch of .pbs files in one directory.

I can qsub the files no problem with this command in the bash shell but for the fish shell, I continuously hit enter and it just creates a new input line. Any ideas why it doesn't work in fish?

for file in *.pbs; do qsub $file; done

glenn jackman
  • 238,783
  • 38
  • 220
  • 352
Kevin
  • 75
  • 3

1 Answers1

1

Fish's syntax for loops and other block constructs is different.

In this case it's

for file in *.pbs
    qsub $file
end

or, on one line:

for file in *.pbs; qsub $file; end

Other looping constructs look similar - no introductory "do" and they end with "end".

Other differences here: This behaves like bash with the nullglob option, so if no file matches the for-loop simply won't be executed, there's no need to guard for a literal *.pbs being passed.

Also the $file doesn't need to be quoted because it's set as one element and so it will be passed as one element, no word splitting takes place.

Fish uses a different script syntax from bash and other shells. To read up on it: Fish for bash users is the quick starting point, but the rest of the documentation is worth reading (in my, admittedly biased, opinion).

faho
  • 14,470
  • 2
  • 37
  • 47