How to pass * as part of argument string to script?
Karl Auer
kauer at biplane.com.au
Thu Aug 26 18:57:04 UTC 2021
On Thu, 2021-08-26 at 14:12 +0200, Bo Berglund wrote:
> This is why my script prunelist is so elaborate because it lists the
> *older* files to remove.
Then skip the last part of the list instead of the first:
#!/bin/sh
SKIP=$1
shift
N=`expr $# - $SKIP`
FTR=`echo $* | tr " " "\n" | head -n $N`
rm $FTR
"FTR" means "Files To Remove" :-)
"tr" replaces spaces with newlines so head sees a list of lines.
Regards, K.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
GPG fingerprint: 61A0 99A9 8823 3A75 871E 5D90 BADB B237 260C 9C58
Old fingerprint: 2561 E9EC D868 E73C 8AF1 49CF EE50 4B1D CCA1 5170
More information about the ubuntu-users
mailing list