SCIENTIFIC-LINUX-USERS Archives

July 2014

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
ToddAndMargo <[log in to unmask]>
Reply To:
ToddAndMargo <[log in to unmask]>
Date:
Sun, 13 Jul 2014 02:26:59 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (26 lines)
Hi All,

In bash script, I don't seem to be able to call a function
from "find -exec".   What am I doing wrong?  (Google is of
no help.)

Many thanks,
-T

cat ./eraseme
#!/bin/bash

Test () {
  echo "$1" | sed -e "s/\/home//"
}

Test "/home/CDs/Keepers/Linux/bash/grep_if_examples.txt"
find /home/CDs/Keepers/Linux/bash -exec Test {}   \;




$ ./eraseme
/CDs/Keepers/Linux/bash/grep_if_examples.txt
find: `Test': No such file or directory

ATOM RSS1 RSS2