LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-09-2003, 09:13 PM   #1
james_cwy
Member
 
Registered: Nov 2003
Posts: 52

Rep: Reputation: 15
Linux commands in shell scripts


Can we actually have linux commands in shell scripts?
Eg: mv a.txt new.config
or cat a.txt > new.config
or cp a.txt new.config

Thanks
James
 
Old 11-09-2003, 09:19 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Yes :)

Basically, anything you can do in bash,
you can do in a script (and the other way
round ;}) ...

Cheers,
Tink
 
Old 11-09-2003, 09:30 PM   #3
james_cwy
Member
 
Registered: Nov 2003
Posts: 52

Original Poster
Rep: Reputation: 15
Merging two shell scripts

Lets say we have two shell scripts:taken from linux honeyd kit
1.start-arpd.sh
#!/bin/sh
#
# Aprd startup script.
# Marcus Ranum/Lance Spitzner 3 Jan, 2003
#
# PURPOSE: To start the Arpd process
# Add '-d' to command line for debug information

set -x

# Monitor just these IP addresses
./arpd 192.168.1.0/24

2. start-honeyd.sh
#!/bin/sh
#
# Honeyd startup script.
# Marcus Ranum/Lance Spitzner 3 Jan, 2003
#
# PURPOSE: To start the Honeyd process
# Add '-d' to command line for debug information

set -x

./honeyd -p nmap.prints -f honeyd.conf -x xprobe2.prints -a nmap.assoc \
-l /var/log/honeyd 192.168.1.201-192.168.1.204
My Question is: Can we combine the two into one single shell script?
How can I do that?

Thanks a million
James
 
Old 11-09-2003, 09:43 PM   #4
lotusjps46
Member
 
Registered: Apr 2003
Location: Dallas
Distribution: Vector Linux, Suse 10.1
Posts: 186

Rep: Reputation: 30
I would try this. This assumes that these are run from the same directory originaly. But I think you get the idea.

Chuck
#!/bin/sh
#
# Aprd startup script.
# Marcus Ranum/Lance Spitzner 3 Jan, 2003
#
# PURPOSE: To start the Arpd process
# Add '-d' to command line for debug information

set -x

# Monitor just these IP addresses

./arpd 192.168.1.0/24

# Honeyd startup script.
# Marcus Ranum/Lance Spitzner 3 Jan, 2003
#
# PURPOSE: To start the Honeyd process
# Add '-d' to command line for debug information

set -x

./honeyd -p nmap.prints -f honeyd.conf -x xprobe2.prints -a nmap.assoc \
-l /var/log/honeyd 192.168.1.201-192.168.1.204
 
Old 11-10-2003, 01:14 AM   #5
fyoder
Member
 
Registered: Nov 2003
Posts: 111

Rep: Reputation: 15
Yes. And if you're familiar with autoexec.bat from windows, be sure to check out /etc/rc.d/rc.local for any command you want to run at start up. Most distro's have one, even those which use a more complicted multidirectory startup routine. The only exception I've run across is gentoo, but it has something similar.

A text editor is powerful tool in Linux, worlds away from ol' Notepad.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
implementation of linux shell for a set of commands satishkumar LinuxQuestions.org Member Intro 1 10-09-2004 04:28 PM
how can i run a shell scripts (or a number of commands )when a user logs in to a linu rddreamz Programming 4 05-20-2004 03:08 PM
shell scripts in linux dopper Linux - Software 3 10-05-2003 05:12 PM
writing Linux shell scripts in Windows NightWolf_NZ Linux - Newbie 3 09-10-2003 09:28 PM
using shell scripts with modem under linux gkrumins Programming 2 06-06-2002 01:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration