Hi, we were given a list of instructions to follow and all was going well until I got to a particular problem.
http://s14.postimg.org/uh30pax2p/201...57_Capture.png
I'm stuck as I can only use each command once. Any help is much appreciated! (sorry for being a noob)
I want to write a bash shell script to execute a command for one minute then stop that command (ctrl c) pause for 10 seconds then run another command for one minute then stop that command pause for 10 seconds then go back to the begining of the script and loop indefinetly.
First I want to run this command for one minute;
reaver -i mon0 -c 6 -b "mac address" -a -vv
stop previous command and pause for 10 seconds
Then run this command for one minute;
airodump-ng -i mon0
stop previous command and pause for 10 seconds
Then recall reaver command and continue to loop through until reaver spits out result.
I imagine I will need to create a function for each command, an if statement and an ifelse statement and I will need the break and sleep commands. but I am not sure about the syntax, PLEASE HELP THIS NOOB!
Please tell me for shell script..
I m writing the script.
In that script i written the 1 function and in that function i have to write the contents in existing file
so i write,
cat > /etc/puppet/manifests/init.pp
{
ensure => present,
}
.
But it caanot write the changes in ssh machine
so what i can do in my script?
Please help me...
Hi,
I am looking for a simple shell script that allows for sftp to be run from the server to another server (Windows). I would like the script to be passed parameters suchas destination server, Id, password, Directory structure/folder name, file name etc...
Need some help to know how to start with and it would be great if someone help me with any sample sftp shell script
I have a shell script that calls an expect script I wrote to ssh login to another host and get user input regarding that host's network configuration. I pass four arguments to the expect script: the remote host ip address, the username, the password, and the list of commands to run. My expect script is below:
#!/usr/bin/expect
# Usage: expectssh <host> <ssh user> <ssh password> <script>
set timeout 60
set prompt "(%|#|\\$) $"
set commands [lindex $argv 3];
spawn ssh [lindex $argv 1]@[lindex $argv 0]
expect {
"*assword:" {
send -- "[lindex $argv 2]\r"
expect -re "$prompt"
send -- "$commands\r"
}
"you sure you want to continue connecting" {
send -- "yes\r"
expect "*assword:"
send -- "[lindex $argv 2]\r"
expect -re "$prompt"
send -- "$commands\r"
}
timeout {
exit }
expect -re $prompt
send -- "exit\r"
}
The script runs well, except that if I send a command such as 'read' that requires user input, the script does not continue or exit after the user presses enter. It just hangs.
The commands I pass to the expect script and it's call are as follows:
SCRIPT='hostname > response.txt;netstat -rn;read net_card?"What is the network interface card number? " >> response.txt; read net_mask?"What is the subnet mask? " >> response.txt'
/usr/bin/expect ./expectssh.exp $hostip $usr $pswd "$SCRIPT"
Any suggestions on how I can pass a command to my expect script that requires user input without it hanging?
On a side note because I know it will come up - I am not allowed to do key-based automatic SSH login. I have to prompt for a username and password, which is done from my main shell script.
Thanks for any suggestions and help you can provide!
Hi guys I just started learning Linux, Need some help writing the script for the following
1. An argument of the form-6 sets the script to display the first 6 lines of the succeeding file(s). the default should be 5.
2. Anything else of the form "-x" should produce an error message
3. For a file name, display the first _lines of the file
hai everyone......can anyone plz help me what if some commands not found in sbin? say ifonfig,setup etc comands? and how to add commands in bin without script writing...help is appreciated ..tnx in advance
Just bought a chrome book and worked with my 10 year old to try to install minecraft through linux.
I followed the following instructions
http://itechtriad.com/articles/2014/...n-a-chromebook
to enter developer mode in chromeos. Successfully istalled linux. Using KDE. I downloaded minecraft for linux. but instructions say I should be able to click bottom left KDE kickstarted button and see "edit applications" but it isnt there.
SO i have linux up. I have minecraft in. But I am stuck. (And I still think I need java installed. Any advice/
Hello Friends,
I want to pass string variable with its value taken by user as command parameter in shell script, example below:-
echo "Enter New Password:="
read password
perl -pi -e
's/PASSWORD=.*?,/$password,/' abc.txt
Please let me know...
Thanks In advanced.
Hi All,
i got a question (noob of course), stuck with my little script when i try to send this while loop into background.
cat stogrpexport | awk 'NR>1' | while read id2 &
do
echo $id2 >> stat.out &
symstat -sid 1075 -i 5 -c 5 -dev $id2 >> stat.out &
done
symstat is a vmax storage command for stat reading which taking long time to complete. is there any better wat to re-write this loop? thanks.
Hi,
What are the benefits that we get when we choose to source a file rather than execute it as a shell script?
and then in what way is export opposite to source?
It looks like they are doing the same thing, i.e making environment variables accessible in the local shell