Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problem with interactive bash shell versus scripted

Posted on 2006-06-20
1
Medium Priority
?
194 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 15

Accepted Solution

by:
bpmurray earned 2000 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

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

Question has a verified solution.

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

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 demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

721 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