A simple shell question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting A simple shell question
# 1  
Old 10-31-2001
A simple shell question

Hi all...

here is my question: in the following, will the `cd $ref_ntp` work?

Code:
for i in `cat $fic`
do
{
       echo " "
echo ================$i=============================
OS=`$CMD -s $i "uname"`
case $OS in
SunOS)
ref_ntp=/ref/ntp/SUN
;;
HP-UX)
ref_ntp=/ref/ntp/HP
;;
esac
 $CMD -s $i "/usr/bin/ftp -v -n `@IP` << cmd
                 user `user` `passwd`
                 cd  $ref_ntp
                 lcd /tmp
                 get install.sh
                 quit
                 cmd "
 $CMD -s $i "/usr/bin/chmod +x /tmp/install.sh"
} >>  $NTP_DIR/resultats/deploi_ntp
sleep 1

done
Thanx
Jason
a_new_admin
# 2  
Old 10-31-2001
Hi

should work
# 3  
Old 11-01-2001
Yes it should work with one caveat...

In your script, if the OS is not SunOS or HP-UX,
the $ref_ntp variable does not get set. You have no
default case to prevent further execution...


case $OS in
SunOS)
ref_ntp=/ref/ntp/SUN
;;
HP-UX)
ref_ntp=/ref/ntp/HP
;;
*)
echo "Unknown OS: $OS"
exit 2
;;
esac
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Syslog.conf: looking for a simple answer on a simple question

Cheers! In /etc/syslog.conf, if an error type is not specified, is it logged anywhere (most preferable is it logged to /var/log/messages) or not? To be more precise I am interested in error and critical level messages. At default these errors are not specified in syslog.conf, and I need to... (6 Replies)
Discussion started by: dr1zzt3r
6 Replies

2. Shell Programming and Scripting

Very simple question 2

Hey , another question is below: Administrator@fe038390aa60482 ~/Frank/20130509 $ c=`ls -ls` Administrator@fe038390aa60482 ~/Frank/20130509 $ echo $c Total 4 1 -rwxr--r-- 1 Administrator None 482 May 9 11:07 do_increment 1 -rwxr --r-- 1 Administrator None 272 May 9 11:32 do_square 1... (2 Replies)
Discussion started by: franksunnn
2 Replies

3. UNIX for Dummies Questions & Answers

Simple Question

Hi Guys, I've been learning UNIX for the past couple of days and I came across this exercise, I can't get my head around it, so I would be ever so grateful if I could receive some sort of help or direction with this. Create a file with x amount of lines in it, the content of your choice. ... (3 Replies)
Discussion started by: aforball
3 Replies

4. Shell Programming and Scripting

Simple Shell Script Question.... [java related]

Hey guys! This is my first post, as im new here :S I have a simple problem for a big program. We have a .sh to install it, but when I run the .sh in terminal like i should, It says the class is not found. I believe it has to do with the syntax, as the person who made it is not a linux pro. I... (3 Replies)
Discussion started by: Drags111
3 Replies

5. Shell Programming and Scripting

Simple Question

If given some output such as: "I'm having a senior moment" How do you print the last six characters to the screen? I'm thinking with awk or sed but can't remember how. (1 Reply)
Discussion started by: stepnkev
1 Replies

6. Programming

Simple C question... Hopefully it's simple

Hello. I'm a complete newbie to C programming. I have a C program that wasn't written by me where I need to write some wrappers around it to automate and make it easier for a client to use. The problem is that the program accepts standard input to control the program... I'm hoping to find a simple... (6 Replies)
Discussion started by: Xeed
6 Replies

7. UNIX for Dummies Questions & Answers

Ok simple question for simple knowledge...

Ok what is BSD exactly? I know its a type of open source but what is it exactly? (1 Reply)
Discussion started by: Corrail
1 Replies

8. UNIX for Dummies Questions & Answers

Simple Question

Can anyone tell me if there is a way to remove the encryption from Data CDs by UNIX? Or does anyone know of a program that can remove the encryption? I would much appreciate it! Thanks, -Peaves (2 Replies)
Discussion started by: Peaves
2 Replies

9. Shell Programming and Scripting

two simple question on shell scripts....

:D my first question is how can envoke filename expansion from within a shell script.. forinstance if i execute the script and it asks for a specific directory that i would like to cd to, how can i get the script to use the same file name expension as the command line.. my second question is how... (3 Replies)
Discussion started by: moxxx68
3 Replies

10. UNIX for Advanced & Expert Users

Simple Question

Friends, I did following exercise $ echo '' > test $ od -b test $ echo "">test $ od -b test $echo > test $od -b test Every time I got the following output 0000000 012 0000001 But 012 is octal value for new line character . Even though there is no apperent new line character... (6 Replies)
Discussion started by: j1yant
6 Replies
Login or Register to Ask a Question