![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sed remove last 10 characters of a line start from 3rd line | minifish | Shell Programming and Scripting | 7 | 03-26-2008 01:42 PM |
| extract a particular start and end pattern from a line | manish205 | Shell Programming and Scripting | 7 | 02-07-2008 03:18 AM |
| RegExp: From first occurrance to last (at line start) | jjinno | Shell Programming and Scripting | 6 | 01-08-2008 01:04 PM |
| How to prompt for input & accept input in ONE line | newbie168 | Shell Programming and Scripting | 2 | 09-27-2005 02:02 AM |
| using command line input in C code | vannie | High Level Programming | 2 | 02-28-2002 12:47 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Start Input not on next line?
I'm curious also to find if it is possible to begin input in this manner
Code:
$script.sh input Has anyone done this before? Its probably a normal enough requirement? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
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.
|
|
#3
|
|||
|
|||
|
it doesn't seem to work that way for me...
my first lines are Code:
#!/bin/sh read variable |
|
#4
|
||||
|
||||
|
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: Code:
#!/bin/sh variable=$1 echo $variable |
|
#5
|
|||
|
|||
|
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. |
|||
| Google The UNIX and Linux Forums |