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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 12-04-2005
grahamb grahamb is offline
Registered User
  
 

Join Date: Dec 2005
Location: Windsor, Ont Canada
Posts: 13
find: problems escaping printf-command string

Hi Folks!

Can you help me with this find -printf command. I seem to be unable to execute the printf-command from my shell script. I'm confused:

My shell script snippet looks like this:
Code:
#!/bin/sh
..
COMMAND="find ./* -printf '%p %m %s %u %g \n'"
echo "Command: ${COMMAND}"
${COMMAND} > ${ARCHIVE_DIR}/${CURRENT_FILE}
With or without the single quotes enclosing the %p, etc, I get this error message:
Code:
Command: find ./* -printf '%p %m %s %u %g \n'
find: paths must precede expression
At the command line (bash), the command works. Further-more it only works for me with the single quotes enclosing the printf-command string.

Look forward to your replies
Grahamb

Using Fedora2.54 with bash; and #!/bin/sh for shell execution