zsh-users
 help / color / mirror / code / Atom feed
* Parameter Expansion
@ 2017-08-13 22:58 Clint Priest
  2017-08-13 23:51 ` Bart Schaefer
  0 siblings, 1 reply; 13+ messages in thread
From: Clint Priest @ 2017-08-13 22:58 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 396 bytes --]

Having trouble getting nested parameter substitution working again, how 
can these two lines be correctly merged into a single line:

     FUNCS=( $SD/autoload/*);
     FUNCS=${(@)FUNCS:t};

Assume for arguments sake that SD is a working directory with an 
autoload directory and autoload has one file in it (named pv).

The above two lines together properly produce ( pv ).

Thanks,

-- 
-Clint

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Parameter expansion
@ 1999-05-17  9:39 Roland Jesse
  1999-05-17  9:23 ` Peter Stephenson
  0 siblings, 1 reply; 13+ messages in thread
From: Roland Jesse @ 1999-05-17  9:39 UTC (permalink / raw)
  To: zsh-users

The zsh manual says regarding to parameter expansion:

  ${+name} 
    If name is the name of a set parameter `1' is substituted, otherwise `0' is
    substituted.

But why do I do get the following than?

% if [ ! ${+BLURB} ]; then
then> echo "BLURB not set"
then> else
else> echo "BLURB set"
else> fi
BLURB set
% 

I was expecting the opposite. Curiously:


% export BLURB=foo
% if [ ! ${+BLURB} ]; then
echo "BLURB not set"
else
echo "BLURB set"
fi
BLURB set
%

Maybe the question should be: How do you check whether or not an
environment variable is set?

Comments are appreciated.

	Roland


^ permalink raw reply	[flat|nested] 13+ messages in thread
* Parameter expansion
@ 1999-03-31 14:35 Mircea Damian
  1999-03-31 14:54 ` Geoff Wing
  0 siblings, 1 reply; 13+ messages in thread
From: Mircea Damian @ 1999-03-31 14:35 UTC (permalink / raw)
  To: zsh-users


Hello,

I need some help here and maybe someone of you can help.

Supposing that I have this directory structure:

dir -+- backup -+- file.1
     |          +- file.2
     |          +- anotherfile.txt
     |          +- dont_backup
     +- index.txt

And index.txt is:
file*
another*

I want to create an archive for the files that are matched by the contents of
index.txt


I tried in dir/ to run the command:

zip backup.zip $(<index.txt)

but that didn't worked because the file* another* weren't expanded. How do
I tell him(zsh 3.1.5) to expand the result of $(<index.txt)?

Thanks!

-- 
Mircea Damian
Network Manager
dmircea@roedu.net, dmircea@lbi.ro, dmircea@kappa.ro
MD65-RIPE, MD2225, MD1-6BONE


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-08-14  1:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-13 22:58 Parameter Expansion Clint Priest
2017-08-13 23:51 ` Bart Schaefer
2017-08-14  0:07   ` Bart Schaefer
2017-08-14  1:16     ` Clint Priest
  -- strict thread matches above, loose matches on Subject: below --
1999-05-17  9:39 Parameter expansion Roland Jesse
1999-05-17  9:23 ` Peter Stephenson
1999-03-31 14:35 Mircea Damian
1999-03-31 14:54 ` Geoff Wing
1999-03-31 15:04   ` Mircea Damian
1999-03-31 15:51     ` Bart Schaefer
1999-04-01  6:20       ` Rob Hooft
1999-04-01  7:30         ` Geoff Wing
1999-04-01  7:33         ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).