0

I've written a simple bash script, named ocropus:

#!/bin/bash
read filename path
...

And then i realized that I can't run it like this:

ocropus filename path

Instead, I need to run it like this:

ocropus
filename path

What can I do so I don't need to hit enter before my inputs? Thanks a lot!

shellter
  • 36,525
  • 7
  • 83
  • 90
  • 1
    Use the arguments instead of reading input. http://tldp.org/LDP/abs/html/othertypesv.html – tkausl Aug 22 '16 at 19:08

1 Answers1

1

Command line arguments are in $1, $2, etc. So do:

filename=$1
path=$2

instead of

read filename path
Barmar
  • 741,623
  • 53
  • 500
  • 612