You are not logged in.
Pages: 1
I want to know how you most easily do this. Often I find myself doing this command:
for a in PATTERN; do cksfv -i -g $a/*.sfv; done
I would like to make a simple command that I can issue like:
chk PATTERN
and it would run that command. But I'm not sure how. I've stolen a .zshrc and built a function out of it (from the examples in that). But it doesn't work:
function chk {
for a in $1; do cksfv -i -g $1/*.sfv; done
}
And I ussue:
chk PATTERN*
But it will only take the first one in the pattern not all of the patterns. So how would I make something that takes all?
But it only uses the first file.
(the -i flag is to ignore cases and -g is to select a file)
We met up with the aliens and guess what? They have no word for fluffy!
Offline
use single quotes to prevent shell substitution.
chk 'PATTERN*'
Offline
use single quotes to prevent shell substitution.
chk 'PATTERN*'
Will not work:
chk 'PATTERN*':
chk:1: no matches found: PATTERN*/*.sfv
chk 'PATTERN'
chk:1: no matches found: PATTERN/*.sfv
chk 'PATTERN'*'' will give same as chk PATTERN, it only takes the first
We met up with the aliens and guess what? They have no word for fluffy!
Offline
You need to update your function:
function chk {
for a in $1; do cksfv -i -g $a/*.sfv; done
}
Offline
Oh, sorry. I'm a stupid man.
Your function must looks like this:
function chk {
for a in $@; do cksvf -i -g $a/*.sfv; done
}
And you can call it like this (without quotes):
chk PATTERN*
Offline
eXire: Thank you very much. That solved it!
We met up with the aliens and guess what? They have no word for fluffy!
Offline
Pages: 1