help for newbie writing shell scripts


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers help for newbie writing shell scripts
# 1  
Old 04-25-2001
Hi, I have just started a Systems Programming course and am required to write a c shell script as part of it.

I have little to no clue about unix.

The spec states that the script can be run only once on each host by a user, but the script can be run on different hosts by the one user.

How would I go about determining whether the script is running on the host?? and how do I activate the script on a remote host, I tried rsh hostname scriptname, but got some type of protocol error, the script relies mainly on the who command.

all help appreciated...

Rich
# 2  
Old 04-25-2001
This post is slightly unclear. However, it is common to use rsh (ssh is prefered to execute commands on remote boxes) rsh -l <username> <host> <script>
rsh -l test bla.com /usr/src/bla.sh
# 3  
Old 04-27-2001
sorry about being unclear.

I have tracked the problem down to this:

in a shell script, what command will create an empty file?

how can I then test if this file exists and execute a statement conditionally?
i.e
if fileexists
statement

also additional questions:

how can I interrupt a background process without resorting to the process table and kill command?

how can I ensure the (infinitely running) shell script exits when I logout, for e.g if I had the script running as
a background process with output redirected to file, it will continue to run, I need to stop this from happening, and ensure that the same code that handles the interrupt is executed whenever I logout.

thanks very much for any help.

Rich



 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Asynchronous shell scripts question - newbie

Hi All, I am fairly new to UNIX and very new to this forum too. This is my first post here. Here is my scenario - I have 3 scripts script1, script2 and script3. I want to start script1 and script2 asynchronously. Upon completion of both scripts script1 and script2, i want to fire the last... (4 Replies)
Discussion started by: taskeen21
4 Replies

2. Shell Programming and Scripting

Writing Bash shell scripts corresponding to windows bat files

Experts, I am newbie in shell scripting. I want to write Bash shell scripts corresponding to windows bat files. I have installed cygwin at c:\cygwin and i am trying to crate the sh file using vi editor. i am not able to understand how to use linux/unix convention for the code. following is my... (15 Replies)
Discussion started by: rajuchacha007
15 Replies

3. Shell Programming and Scripting

newbie: writing ksh shell problem

my default profile is using ksh, I tried to write a simple scripts and I had issues, below is my scripts: $ more if_num.ksh USAGE="usage: if_num.ksh" print -n "Enter two numbers: " read x y if ((x=y)) then print "You entered the same number twice." when I tried to executed the... (6 Replies)
Discussion started by: matthew00
6 Replies

4. Shell Programming and Scripting

Newbie question-do I pause and exec my shell scripts?

Hi there, I'm writing a script to restore 3 directories and 3 mysql db's every 24 hours. While writing the script, I came across the thought... Do I need to pause between executions? Example: msql restore1.sql rm -Rf path1/* cp -Rf path1/* /restore1 chmod 777 /folder1/cache1 ... (2 Replies)
Discussion started by: semiotics101
2 Replies

5. Web Development

Problems writing app that will communicate with gateway(newbie,last bit of project)

Hi all, Im writing an app that will contact a specified gateway and retrieve info onto our server and perform manipulations on it then return the result back to the gateway for further operations... But I'm a newbie and dont have much of an experience in network programming... Would like to... (0 Replies)
Discussion started by: wrapster
0 Replies

6. Shell Programming and Scripting

writing shell scripts of commands

can anyone help me in writing a shell script to visualize how simple commands work and on what logic. For Eg: ls command how it lists out all the files and directories, need to write a simple script based on the commands source code.:D (0 Replies)
Discussion started by: rahul_11d
0 Replies

7. Programming

Basic questions on writing a Unix Service (newbie help!)

Hi there. I've got 12 years experience writing C++ on Windows, and 3 years C# on Windows. Now my boss wants me to write a C++ app to run on Unix as a multithreaded 'service' (i.e. a program that runs with no user intervention). Some quick questions for The Experts: * Whats the best C++... (3 Replies)
Discussion started by: Rutland Gizz
3 Replies

8. AIX

Examples of writing shell scripts for AIX, it's urgent

Please help me 1. Please give me the few examples of shell scripts written for AIX 2.I have scripts written on Unix, does that work for AIX, if not what are the changes to be carried out to run the scripts on AIX.... Please help me (4 Replies)
Discussion started by: me_haroon
4 Replies

9. AIX

Difference between writing Unix Shell script and AIX Shell Scripts

Hi, Please give me the detailed Differences between writing Unix Shell script and AIX Shell Scripts. Thanks in advance..... (0 Replies)
Discussion started by: haroonec
0 Replies

10. Shell Programming and Scripting

Is writing shell scripts different than...

I am currently taking a linux shell scripting class and also a intro to programming class using QBASIC. Will this interfere with how i learn each one? Are they similar in some ways? I already took a unix course based on the commands and it was easy, but now i have to create programs. Also, how... (1 Reply)
Discussion started by: brentdeback
1 Replies
Login or Register to Ask a Question