Touch file inside directory referenced by wild card.

I'm on the AiX system.

ls -d /[Oo]racle/mymac/ returns

/oracle/mymac/ or /Oracle/mymac/ whichever is found on my system.

I wish to touch a file file.tmp inside the found directory.

I was trying

touch | ls -d /[Oo]racle/mymac/ | echo file.tmp

But this does not work.

Can you please suggest how can I get this to work ?

Why you are piping touch 's stdout (which is empty) into ls 's stdin (which doesn't require any) into echo 's(which doesn't either)?

If you're sure there is only either one or the other, try

touch $(echo [Oo]racle/mymac/)file.tmp

echo is preferred to ls here as it is a shell (here: bash ) builtin.

EDIT: tricky use of bash 's "brace expansion" if both dir versions exist:

touch {O..o..32}racle/mymac/file.tmp

I cannot test this on AIX; works on Linux and Solaris:

find . -name '/[Oo]racle/mymac' -exec touch {} \;

Quite simple:

touch /[Oo]racle/mymac/file.tmp

will create a file in whatever directory is present.