[plug] strncmp in shell

Cameron Patrick cameron at patrick.wattle.id.au
Mon Jan 19 14:42:21 WST 2004


Russell Steicke wrote:

| Something like this?
| 
| $ FOO=one
| $ echo ${FOO/one/}

Thanks, that'll do what I wanted! :-)

James Devenish wrote:

| LOL. I guess I need to have some intake of liquids or solids today
| (for some reason I read "strcasecmp" instead of "strncmp"). So...what
| is the problem? I just tried out $FOO[0-6] in Bash and it didn't do
| much.  So..  that is the "hypothetical" part of your post? I would
| imagine this would work in zsh:

Yes, that's the hypothetical syntax.

| if [[ "$FOO" == "wurble*" ]]; then...fi

Aha!  That's also the kind of thing I was hoping to find - only it
doesn't appear to work in my zsh.

% [[ "$FOO" == "wurble*" ]] && echo hi
% [[ "$FOO" == "wurblesplib" ]] && echo hi
hi
% # useless sodding zsh, give me bash instead any day
zsh: command not found: #

:-P

Cameron.




More information about the plug mailing list