troubleshooting Question

script to search files containing searchword?

Avatar of gram77
gram77Flag for India asked on
Unix OSLinuxProgramming
10 Comments2 Solutions290 ViewsLast Modified:
a. I need to create a shell script that searches all files under directories a,b,c,d
containing the word 'ftp' or 'put'.
And then print the log of resulting filenames containing the word 'ftp' to a file.

b. The files identified above are passed parameters such as HOSTNAME,DIRECTORY etc. as seen in the underlying script.

The shell script should identify which shell scripts are calling these files.
For example the program identifies that abc.sh calls def.sh; rst.sh calls xyz.sh and so on

---------
def.sh
---------
PID=$$
HOSTNAME=$1
DIRECTORY=$2
FILENAME=$3
SUFFIX=$4
USERNAME=$5
PASSWORD=$6
 
if [ -s $INTFILE ] && [ -f $INTFILE ]
then

      ftp -n $HOSTNAME << EOF
      quote user $USERNAME
      quote pass $PASSWORD
      cd $DIRECTORY
      ascii
      put $INTFILE $EXTFILE
      quit
EOF
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros