Solved

Problem with interactive bash shell versus scripted

Posted on 2006-06-20
1
187 Views
Last Modified: 2010-04-22
Hi I've encountered the following problem. , Oh i'm using cygwin.
The folllow command

$ find . -name 'BuildLog.htm' -printf "'%P'\n\r"

and it works exactally as I expect. It finds all BuildLog.htm files from the current directory and below. Then prints out each file path\name as a quoted string.

However whin I try and script it the script runs witout errors but finds nothing

#!/bin/sh

LOG_FILE=\''BuildLog.htm'\'
Pattern=\"\'%P\'\\n\\r\"
echo find . -name $LOG_FILE -printf $Pattern
find . -name $LOG_FILE -printf $Pattern
0
Comment
Question by:MichaelAllen
1 Comment
 
LVL 15

Accepted Solution

by:
bpmurray earned 500 total points
ID: 16941677
Don't know why you have all those escapes, but this works fine:

LOG_FILE="*.tmp"
Pattern="%P'\\n\\r"

find . -name "$LOG_FILE" -printf "$Pattern"

And, of course, it gives the same result as:

find . -name "$LOG_FILE" -print
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now