The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell script 'find' command bsavitch UNIX for Dummies Questions & Answers 1 06-22-2008 01:15 AM
find command from a shell script kodermanna UNIX for Advanced & Expert Users 6 01-28-2008 06:37 AM
Wrapping ksh script nir_s Shell Programming and Scripting 2 05-30-2006 03:37 AM
Find Command In Script kdreaves SUN Solaris 3 01-21-2004 11:28 AM
Wrapping a bash script for CGI andyj Shell Programming and Scripting 2 07-16-2003 01:46 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-23-2008
mirusko mirusko is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 14
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 (permalink)  
Old 10-23-2008
ashishparimoo ashishparimoo is offline
Registered User
  
 

Join Date: Oct 2005
Location: UK
Posts: 8
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 (permalink)  
Old 10-23-2008
mirusko mirusko is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 14
YES, it does work, great, thank you!
K.
  #4 (permalink)  
Old 10-23-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,308
Place the command within quotes:

Code:
echo "`find /etc  -perm -o=w -exec ll '{}' \;`"
Regards
  #5 (permalink)  
Old 10-23-2008
mirusko mirusko is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 14
that works too! Thank you
K.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:39 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0