Solved

Problem with interactive bash shell versus scripted

Posted on 2006-06-20
1
190 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Centos Boot Error 42 122
How to import linux vhd to sccvmm 1 154
understanding folder structure inside an rpm 2 69
add some character at the end of line in vi 7 79
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

772 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