![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Feb 2005
Posts: 37
Rep Power: 0
![]() |
Input help
I was gonna try something but I wanted to ask you guys if you could tell me if there is a way to insert a string into a shell command.
Ex: Lets say i have the script #!usr/bin/perl $su = "su"; # 'su' is a unix command system($su); and when you run it you get $perl test.pl Password: so what i am asking is if there is a way to put the password into the Password field and then execute it. |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
Join Date: Oct 2005
Posts: 134
Rep Power: 4
![]() |
You need to open a pipe to the other program and write to it.
#!usr/bin/perl $pid = open(WRITEME, "| su") or die "Couldn't open $!\n"; print WRITEME "the_password\n"; close(WRITEME) or die "Couldn't close: $!\n"; For more info: http://www.unix.org.ua/orelly/perl/cookbook/ch16_05.htm |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Feb 2005
Posts: 37
Rep Power: 0
![]() |
thanks alot
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|