I am constantly running commands like
nohup psql -d db -f foo1.sql >& foo1.out &
nohup psql -d db -f foo2.sql >& foo2.out &
I was wondering how to create a shellscript that takes as input the filename parameter like foo1.sql and runs the command above.
How do I write a script called test so that the command ./test foo1.sql will execute the command
nohup psql -d db -f foo1.sql >& foo1.out &
Try this
It’s not called with
./test(foo1.sql)but./test foo1.sql, as shown after the question was edited.