how this scrypt work


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how this scrypt work
# 1  
Old 11-04-2009
how this scrypt work

hi i want to know what is the output of this lines
Code:
     LineNr=`fgrep -n $Search $File |cut -d: -f1` # Zeilennummer ntp
     Cmd="$LineNr s/^# //\nw\nq"     # ed-Kommando
     echo "$Cmd" | ed -s $File >/dev/null   # ed-Aufruf

in below scrypt
Code:
    
    File=/etc/inittab        # Datei zum Bearbeiten
    Search=Ntp.Cntl         # String zum Suchen
    if [ -n "`fgrep $Search $File`" ]
    then
     LineNr=`fgrep -n $Search $File |cut -d: -f1` # Zeilennummer ntp
     Cmd="$LineNr s/^# //\nw\nq"     # ed-Kommando
     echo "$Cmd" | ed -s $File >/dev/null   # ed-Aufruf
    else
     LineNr=`fgrep -n InfPmBoot $File | cut -d: -f1` # Zeilennummer 
 PmBoot
     Line="pm:2:once:/sys/inf/InfPmCall /sys/inf/Ntp.Cntl stop"
     Line="$Line >/dev/null 2>&1"     # Zeile zum Einfuegen
     Cmd="$LineNr a\n$Line\n.\nw\nq"    # ed-Kommando
     echo "$Cmd" | ed -s $File      # ed-Aufruf
    fi


Last edited by kaydream; 11-04-2009 at 12:59 AM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. IP Networking

Discussion at work, would a router work pluging a cable in wan1 and lan1?

hi all. and sorry for the random question, but this sparkled a raging flame-war at work and i want more points of view situation a router, with linux of some sort, dhcp client requesting for ip in wan1 (as usual with wan ports) dhcp server listening in lan1, and assigning ip (as usual... (9 Replies)
Discussion started by: broli
9 Replies

2. Shell Programming and Scripting

My script work on Linux but not work in sunos.

My script work on Linux but not work in sun os. my script. logFiles="sentLog1.log sentLog2.log" intial_time="0 0" logLocation="/usr/local/tomcat/logs/" sleepTime=600 failMessage=":: $(tput bold)Log not update$(tput rmso) = " successMessage="OK" arr=($logFiles)... (7 Replies)
Discussion started by: ooilinlove
7 Replies

3. IP Networking

NIC will not work, but it did work.

I have a client machine that was built and loaded with SCO UNIX 2.1.3, (yes it is old). The machine worked fine on the closed network that I tested on in my shop. I then had to change it to the network that it would be connected to. Below is the host file, router and subnet mask file that I usually... (0 Replies)
Discussion started by: NC user
0 Replies

4. UNIX for Advanced & Expert Users

Meaning of scrypt

hi every one i want to know meaning of this scrypt if then if then cp $ConfData/inf/ntp.conf /etc cp $ConfData/inf/ntp.keys /etc chown bin /etc/ntp.conf /etc/ntp.keys chgrp bin /etc/ntp.conf /etc/ntp.keys chmod 640 /etc/ntp.conf... (1 Reply)
Discussion started by: kaydream
1 Replies

5. UNIX for Dummies Questions & Answers

what is output of this scrypt

hello every one i want to know how this scrypt work and what is the output if then if then cp $ConfData/inf/ntp.conf /etc # ntp-Dateien nach cp $ConfData/inf/ntp.keys /etc # /etc kopieren chown bin /etc/ntp.conf /etc/ntp.keys # owner setzen chgrp bin... (1 Reply)
Discussion started by: kaydream
1 Replies

6. Red Hat

"SCRYPT" command in RED HAT 9

Hello, I wanted to simple command to encrypt a file. Using google I got a command "crypt". I could test it very well on Sun solaris. My red hat system says "command not found".Can you please tell me if I can find that package on the cd!!! (2 Replies)
Discussion started by: nsharath
2 Replies

7. Linux

Come and work for me! (UK)

********nothing too see here!!!****** (2 Replies)
Discussion started by: TonyChapman
2 Replies

8. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies

9. UNIX for Advanced & Expert Users

how does this work???

can someone tell me the meaning of this commnad, If you want to see a grand total of CPU time for a program when it finishes running, you can use the time command. At the Unix prompt, enter: time java myprog Replace myprog with the name of the program you are running. The following is an... (1 Reply)
Discussion started by: ldpathak
1 Replies

10. Shell Programming and Scripting

Will this work?

I'm trying to check if files already exist in a directory. They have the same basename (exsyctr1), but 4 different extensions. If the files exist, then I make backups of them, then copy them from another directory ($livecomp/data) to the current one ($copycomp/data). If they don't exist, just... (5 Replies)
Discussion started by: Ypnos
5 Replies
Login or Register to Ask a Question