find command and wrapping in the script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find command and wrapping in the script
# 1  
Old 10-23-2008
find command and wrapping in the script

Hello, I've been trying to use find command to find and print out some files. When I execute the command on the command line I get the output as expected howerver when I run it in the script it doesn't wrap.

For example, this is nicely wraped
find /etc -perm -o=w -exec ll '{}' \;
lrwxrwxrwt 1 root sys 20 Aug 26 15:13 /etc/vtdaemonlog -> /var/adm/vtdaemonlog
lrwxrwxrwt 1 root sys 14 Aug 26 15:13 /etc/savecore -> /sbin/savecore
lrwxrwxrwt 1 root sys 18 Aug 26 15:13 /etc/dumpdates -> /var/adm/dumpdates

but when I do the same command in the ksh script, like like
echo `find /etc -perm -o=w -exec ll '{}' \;`

I get the following

lrwxrwxrwt 1 root sys 20 Aug 26 15:13 /etc/vtdaemonlog -> /var/adm/vtdaemonlog lrwxrwxrwt 1 root sys 14 Aug 26 15:13 /etc/savecore -> /sbin/savecore lrwxrwxrwt 1 root sys 18 Aug 26 15:13 /etc/dumpdates -> /var/adm/dumpdates lrwxrwxrwt 1 root sys 22 Aug 26 15:13 /etc/dce.clean -> /opt/dce/bin/dce.clean srwxrwxrwx 1 root root 0 Aug 26 16:20 /etc/useracct/utmpd_read -rwxrwxrwx 1 root root 3640 Oct 23 09:12 /etc/utmpx

everything is on one line ... there is no end line.
How can I make it print each record on 1 line?

Thank you,
Kubko
# 2  
Old 10-23-2008
why are you using echo? you can use the command as it is. no need to echo it
remove echo and backquotes i-e ` it should work
# 3  
Old 10-23-2008
YES, it does work, great, thank you!
K.
# 4  
Old 10-23-2008
Place the command within quotes:

Code:
echo "`find /etc  -perm -o=w -exec ll '{}' \;`"

Regards
# 5  
Old 10-23-2008
that works too! Thank you
K.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting a list to X columns of csv (& wrapping a command around it)

Hi All, Random question, how would you convert a data file from a list like so: 12345 12346 12347 12348 12349 12350 ... <snip 100+ lines> ... to comma separated X columns across: 12345,12346,12347 12348,12349,12350 Why would you want to do this? The background to this is a... (2 Replies)
Discussion started by: craigp84
2 Replies

2. Shell Programming and Scripting

find command in shell script

Hi, dirs.conf fine contains below data /a/b/c/dir1|50 /a/b/c/dir2|50 /a/b/c/dir3|50 In a shell script I do as below while read file_rec do dir_name=`echo "${file_rec}" | cut -d "|" -f 1` purge_days=`echo "${file_rec}" | cut -d "|" -f 2` if then... (3 Replies)
Discussion started by: icefish
3 Replies

3. Shell Programming and Scripting

Find command script

Hi, I want write a script to zip the files in a directory with are not having *.gz extension files. exp: source directory haveing *.log,*.sal,*.txt,*.gz....and some of files with out extension. so i want ZIP the files which are not *.gz files in the same directory. i worte like this: ... (2 Replies)
Discussion started by: koti_rama
2 Replies

4. UNIX for Dummies Questions & Answers

Using the find command in a script

I am new to Shell scripting.Please give some guidence How to place a find command in my shell script? (6 Replies)
Discussion started by: dineshmurs
6 Replies

5. UNIX for Dummies Questions & Answers

bash history and command line wrapping

By default, we use ksh (88) as our shell. I prefer bash, so I added this line to my .profile: exec bash -o viI also added this to my .bashrc?: #*********************************************** #These are important tweaks specific to BASH: #***********************************************... (1 Reply)
Discussion started by: mrwatkin
1 Replies

6. Shell Programming and Scripting

script using find command.

Hi,:) find /etc /bin /usr/bin /usr/sbin /var/adm \ -name '*.a' \ '!' '(' -user root -o -user daemon -o -user bin -o -user sys -o -user adm -o -user uucp -o -user nuucp -o -user lpd -o -user imnadm -o -user ipsec -o -user ldap -o -user lp -o -user snapp -o -user invscout ')' \ '!' '(' -group... (4 Replies)
Discussion started by: sakthilinux
4 Replies

7. UNIX for Advanced & Expert Users

find command from a shell script

Hi experts, I have a shell script (korn shell on aix) where I am giving find command with file options which are read from a configuration file. For some reason I am getting an error find: 0652-017. I have put set -x in the shell script and the command looks okay. If I cut it and paste it in the... (6 Replies)
Discussion started by: kodermanna
6 Replies

8. Shell Programming and Scripting

Wrapping ksh script

Hi folks, We want to protect our ksh scripts from our customers.We don't want to let them the option to viewor modify the scripts. Is there a way ro wrap a ksh script? Thanks in advance, Nir (2 Replies)
Discussion started by: nir_s
2 Replies

9. Solaris

Find Command In Script

I've got two find commands that work when executed from the command line, but don't work when added to an existing script that runs via Cron. The commands: find /unifi_dev_bkup/database/backup_files/prod -name `date +%y`* -mtime +0 -exec rm -r {} \; find /unifi_dev_bkup/aifiles/prod -name... (3 Replies)
Discussion started by: kdreaves
3 Replies

10. Shell Programming and Scripting

Wrapping a bash script for CGI

I hope its ok to start a new thread, I was going to use my existing one but thought a new one would better clarify things and provide better search for future reference. Well I have my bash program working now, all nice, user input validated, output formatted, everything is looking sexy. Now... (2 Replies)
Discussion started by: andyj
2 Replies
Login or Register to Ask a Question