scripting issues...


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers scripting issues...
# 1  
Old 06-26-2006
Question scripting issues...

Hi guys,

I am thanks in advance for any posts and for reading. I am trying to run this script, under solaris:

echo "****************************************"
echo "The host is: "
echo "****************************************"
<<EOF find /etc/default -name login -exec ls -l {} \;
find /etc -name services -exec ls -l {} \;
find /etc -name shadow -exec ls -l {} \;
find /etc/dfs/ -name dfstab -exec ls -l {} \;
find /etc -name inetd.conf -exec ls -l {} \;
find /etc -name hosts.equiv -exec ls -l {} \;
find / -name .rhosts -exec ls -l {} \;
EOF
echo "***************************************"
echo " END OF RECORDS"
echo "***************************************"
exit 0

but its only printing off the first find line, anyone any ideas why the box isn't executing the rest of the script?

thanks again,

Marky Mark...
# 2  
Old 06-26-2006
Lightbulb

I resolved it but rescripting to this:


#!/bin/bash

#################################
#
# Script by Mark Newton
#
#################################

<<EOF_11 cd /
EOF_11
echo "****************************************"
echo " WORKING IN THE:"
<<EOF_12 pwd
EOF_12
echo "****************************************"
echo "****************************************"
echo "The host is: EURCOMUNX001"
echo "****************************************"

echo "******************"
echo "a) /etc/default/login"
echo "******************"

<<EOF find /etc/default -name login -exec ls -l {} \;
EOF

echo "******************"
echo "b) /etc/sevices"
echo "******************"

<<EOF_1 find /etc/ -name services -exec ls -l {} \;
EOF_1

echo "******************"
echo "C) /etc/shadow"
echo "******************"

<<EOF_2 find /etc -name shadow -exec ls -l {} \;
EOF_2

echo "******************"
echo "d) /etc/dfs/dfstab"
echo "******************"

<<EOF_3 find /etc/dfs/ -name dfstab -exec ls -l {} \;
EOF_3

echo "******************"
echo "f) /etc/hosts.equiv"
echo "******************"

<<EOF_5 find /etc -name hosts.equiv -exec ls -l {} \;
EOF_5

echo "******************"
echo "e) /etc/inetd.conf"
echo "******************"

<<EOF_14 find /etc/inet -name inetd.conf -exec ls -l {} \;
EOF_14


echo "*****************"
echo "g) ./rhosts"
echo "*****************"

<<EOF_6 ls -l .rhosts
EOF_6

echo "***************************************"
echo " END OF RECORDS"
echo "***************************************"
exit 0
# 3  
Old 06-26-2006
Helo,
What do you want this script exactly to do?
# 4  
Old 06-26-2006
Computer

Just literally long list a load of files so that I can get the file permissions, instead of doing an ls -l on the entire directory. Its for some audit thing... Anyhow we don't want to show every file under the directory hence the script...
# 5  
Old 06-26-2006
If you just want the file list then (all one line):
Code:
ls -la /etc/default/login /etc/services /etc/shadow /etc/dfs/dfstab /etc/hosts.equiv /etc/inetd.conf /.rhost

If you want it all pretty-printed then how about simplifying it (and adding a "not found" message for completeness):
Code:
function printblock
{
echo "****************************************"
echo "$*"
echo "****************************************"
}

cd /
printblock "WORKING IN THE: $PWD"
printblock "The host is: EURCOMUNX001"

ptr=0
set -A tab a b c d e f g

for a in /etc/default/login /etc/services /etc/shadow /etc/dfs/dfstab /etc/hosts.equiv /etc/inetd.conf /.rhosts
do
  name=${tab[$ptr]}
  printblock "$name) $a"
  if [ -f $a ]; then
    ls -la $a
  else
    echo "File $a not found"
  fi
  ptr=$(($ptr + 1))
done

printblock "END OF RECORDS"
exit 0

# 6  
Old 06-26-2006
I see your point, I might look into this. For min I think I will leave it as is...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issues with awk scripting for HTML tags

Below is the data file(results) contents- 13450708,13470474,US,15 24954,24845,JPN,44 14258992,14365059,US,4 24954,24845,IND,44 I want to send above data sets to email in a tabular format. For that I am using below awk script. Now the challenge I am facing here is - I want to make the... (2 Replies)
Discussion started by: Roseline
2 Replies

2. Homework & Coursework Questions

Having issues finishing up a few scripting problems. A little help would be awesome

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 4. Recall that the env command provides a list of various environment variables available to you. Two of those... (5 Replies)
Discussion started by: megachuk
5 Replies

3. Shell Programming and Scripting

Issues with scripting users

Hello everyone, I am new to the forum community and need help with some scripts. First off let me put that this is “NOT” a homework assignment as I have been given this information where I work (IUPUI-UITS) and need help on this since I have no experience in this area. The only reason I am turning... (1 Reply)
Discussion started by: wingzero89
1 Replies

4. Shell Programming and Scripting

Scripting users issues...

Hello everyone, I am new to the forum community and need help with some scripts. I have attached what I have so far and these are scripts that have been passed on to me for a project that I have been assigned. To tell the truth I have never really worked with scripts and have no clue how these even... (3 Replies)
Discussion started by: wingzero89
3 Replies

5. Web Development

Perl scripting or shell scripting?

i am going to study any one of the scripting languages mentioned above(shell 0r perl scripting) . Which is having more scope for a fresher? (1 Reply)
Discussion started by: Anna Hussie
1 Replies

6. What is on Your Mind?

Shell Scripting vs Perl scripting

Gents, I have been working in a Solaris/Unix environment for about 9 months. I took some linux classses online before getting the job. But, I am not very good at scripting. I want to learn how to script. Do you think that I should start with Shell scripting or Perl? I wanted to continue with... (2 Replies)
Discussion started by: Pouchie1
2 Replies

7. What is on Your Mind?

Shell scripting vs Perl scripting

Hi all, I would like to start developping some good scripting skills. Do you think it would be best to start with shell scripting or Perl? I already got a fundation, really basics, in perl. but I am wondering what would be best to be good at first. Can you please help me determine which one to... (14 Replies)
Discussion started by: Pouchie1
14 Replies

8. Shell Programming and Scripting

Call Shell scripting from Perl Scripting.

Hi How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Discussion started by: anupdas
2 Replies

9. Shell Programming and Scripting

Shell scripting issues

hi, I am stuck in a shell script where in i need to extract the specific users from \etc\passwd file. Once this is done, i need to assign Roles to these users which are different for different users. What could be the optimum solution. If i hard code the Roles values in a text file, how would i... (1 Reply)
Discussion started by: ashutosh101
1 Replies

10. Shell Programming and Scripting

scripting guru's pls help me with scripting on AIX

can someone pls help me with the script for a files coming from one system to a particular directory and i want to write a script to move those files to another directory on different system by renaming the files... pls someone help me on this... thanking in anticipation.... (1 Reply)
Discussion started by: thatiprashant
1 Replies
Login or Register to Ask a Question