From: Frank Wunderlich <frank-w@public-files.de>
To: Sascha Hauer <sha@pengutronix.de>
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>, barebox@lists.infradead.org
Subject: Aw: Re: Re: barebox extending boot-scripts
Date: Sat, 29 Jan 2022 11:40:08 +0100 [thread overview]
Message-ID: <trinity-eba130ad-1bd5-46a1-95bd-4a2ee29c1f96-1643452807981@3c-app-gmx-bs07> (raw)
In-Reply-To: <20220106080838.GV6003@pengutronix.de>
Hi,
> Gesendet: Donnerstag, 06. Januar 2022 um 09:08 Uhr
> Von: "Sascha Hauer" <sha@pengutronix.de>
> It works for example with:
>
> for i in /mnt/sd.1/extlinux/Image*; do basename $i b; echo $b; done
this works with full path, but not if using a var for dir var
barebox@BPI R2PRO:/ i=0;for f in /mnt/sd.1/extlinux/Image*; do basename $f b; echo "$i:$b";let i++; done
0:Image_5.16
1:Image_5.16-next.gz
2:Image_5.16.gz
3:Image_5.16.gz.bak
4:Image_5.16_q64
5:Image_bpi
barebox@BPI R2PRO:/ imgdir=/mnt/sd.1/extlinux/
barebox@BPI R2PRO:/ i=0;for f in $imgdir/Image*; do basename $f b; echo "$i:$b";let i++; done
basename - strip directory and suffix from filenames
Usage: basename PATH VAR
Remove directory part from the PATH and store result into variable VAR.
0:Image_bpi
barebox@BPI R2PRO:/
any idea how to get it working with variable path?
i can do a cd before and drop the basename
cd $imgdir
for f in Image*; do echo $f;done
Image_5.16
Image_5.16-next.gz
Image_5.16.gz
Image_5.16.gz.bak
Image_5.16_q64
Image_bpi
but then i need to restore the path again (something like prevdir=$(pwd);cd $prevdir) if script fails
regards Frank
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2022-01-29 10:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-05 15:20 Frank Wunderlich
2022-01-05 16:07 ` Ahmad Fatoum
2022-01-05 18:13 ` Aw: " Frank Wunderlich
2022-01-06 8:08 ` Sascha Hauer
2022-01-06 12:41 ` Aw: " Frank Wunderlich
2022-01-07 13:07 ` Sascha Hauer
2022-01-07 16:42 ` Aw: " Frank Wunderlich
2022-01-10 9:42 ` Sascha Hauer
2022-01-15 13:47 ` Aw: " Frank Wunderlich
2022-01-17 8:59 ` Sascha Hauer
2022-01-29 10:40 ` Frank Wunderlich [this message]
2022-01-31 11:03 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=trinity-eba130ad-1bd5-46a1-95bd-4a2ee29c1f96-1643452807981@3c-app-gmx-bs07 \
--to=frank-w@public-files.de \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=sha@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox