[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] if exist
From: |
Pierre Gaston |
Subject: |
Re: [Help-bash] if exist |
Date: |
Sat, 13 May 2017 17:20:37 +0300 |
On Sat, May 13, 2017 at 3:56 PM, Val Krem <address@hidden> wrote:
> Thank you so much Piere!
>
>
> xc=("$dat0"/x*'.'txt{1..10})
> echo "address@hidden"
> for i in "address@hidden";do
> if [ -e "${i}" ];then
> cp "$i" "$dat1 "
> fi
> done
>
>
> One more question,though.
> if there are several files ending with the same digit number only the
> first one was copied.
>
> xbx1.txt1
> xby2.txt1
> If it possible to accommodate this well? Instead of writing twice the
> script twice depending on the file patterns
>
With the above code (well without the extra space inside "$dat1 "), it
copies both the files you list.
So please paste your exact problem.
http://ideone.com/5FpIzH