Solved

Problem with interactive bash shell versus scripted

Posted on 2006-06-20
1
186 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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
inotifywait in linux 2 273
how does yum update work 2 41
„dd“ vs „ddrescue“ 28 198
Linux Hanging with disable Error Output 4 69
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 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

15 Experts available now in Live!

Get 1:1 Help Now