Start Input not on next line?

I'm curious also to find if it is possible to begin input in this manner

$script.sh input

where the user enters 'script.sh' but the input goes directly next to the command instead of the new line. \c doesn't seem to work but I think it should be possible.

Has anyone done this before? Its probably a normal enough requirement?

Let me get this straight. Do you want to pass input as a parameter to script.sh ? If yes, then script.sh input works just fine. Else explain again.

it doesn't seem to work that way for me...

my first lines are

#!/bin/sh
read variable

which automatically throws the cursor below the command waiting for input, and if I enter the input directly following the command and press enter then it sits on the next line waiting for the command still...

That is how the read command works. The args passed to a shell script are labelled $1, $2, ..., $9, ${10}, ${11}... The double digit args are not available in the original bourne shell, but you can use them in the ksh and the bash shells.

About your code:

#!/bin/sh
variable=$1
echo $variable

Then run the script the same way that you are currently running it.

ahhh I didn't realise that, I understood the $1 stuff but didn't realise if that was at the top of the page it automatically picked up the input.

Thanks guys am learning heaps.