Re: shell scripts issue

From: Radoulov, Dimitre <cichomitiko_at_gmail.com>
Date: Fri, 27 Nov 2009 11:07:18 +0100
Message-ID: <heo8cu$j4g$1_at_news.eternal-september.org>



On 27/11/2009 10.51, Radoulov, Dimitre wrote:
> On 27/11/2009 6.51, Ram wrote:

>> Hi all,
>>
>> My scripts looks like this .. when i execute this script its says file
>> does not exist even though file is present physically and if the file
>> does not present in the file system then the output is null.
>>
>> I am wrong somewhere .. ??
>>
>>
>> echo " enter file "
>> read name
>> for i in `find /apps12i -type f -name $name -printf %f `
> [...]                                         ^^^^^^

Just noticed you're using a GNU system, so with bash/GNU find you can use the following syntax:

_path="/apps12i"

read -p'enter filename: '

_found="$(

   find "$_path" -type f -name "$REPLY" -printf 'found: %p\n'    )"

[[ $_found ]] &&

   printf '%s\n' "$_found" ||

      printf 'cannot find %s under %s\n' "$REPLY" "$_path"

> Try changing the script like this:
[...]

Dimitre Received on Fri Nov 27 2009 - 04:07:18 CST

Original text of this message