|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Using a variable in a system command
Is there a way to use a pre-defined variable in a system command.
my system command looks like this system("/root/to/my/script `seq $variable`") I thought i was being a bit too hopeful when i tried using the $variable It works when i replace $variable with a number but the variable (the amount of times the script needs to run) depends on the users input. Any ideas? thanks |
|
#2
|
||||
|
||||
|
Yes, a variable will work. What's with the backticks in your system command? Is that something your shell uses?
|
|
#3
|
||||
|
||||
|
__________________
--Ax without exception, there is no rule ... The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones ![]() 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0 Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. -- Jamie Zawinski |
|
#4
|
|||
|
|||
|
cheers for the replies.
I am using back ticks because as far as I can tell thats the syntax when using the seq command e.g ./script `seq 2` will run it twice (with the parameters 1 and 2) if i use ./script seq 2 it runs it with the parameters seq and 2 All of the user input will be fully validated before its used and it turns out I was doing it correct, I just used the name of the input field rather than the variable that i made in my cgi script !!! (now i feel silly)Cheers for your help and i hope i taught you something about seq ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Using a variable in a system command |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|