Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

newbie, scripting problems..



Hello.

Im newbie in shell (zsh).

I rewriting a bash-script, to function also in this "Zsh". And running
into a several problems...:

1. Cant make a dynamic loaded array. In bash:
ToBe[${#ToBe[@]}]="$BTheFile" (that I do inside a loop, with some condition)

2. Wildchars, or if its spelled wildcharts. Test of these. Wild
something I saw in some docs, was this zsh fancy thing. In Bash, this
works: "[[ $A = $B ]] && then do something" (there $A maybe a file , and
$B a wildstring as "*.avi")

I did have problems in Bash for this also, I remember now. There was
some fuzz here, if $B is inside "" or not. But, I cant find any way in
this zsh.


3. "read" didnt read space-separated lines as arrays, by default. But
did with option "-A". BUT this caused error if I later runned the script
as Bash. (I want it to be both bash and zsh compatible)

Some more fuzz, I made some clouds in awk
#aaa=$( echo "one two three" | awk '{ ORS=" "; print "(";  i=1; while (i
<= NF) { print "\""$i"\"" ; i++ } print ")\n" }' )
# Then the new ("one" "two" "tree") is still only one single string.

# THIS WORKS:
# aaa=( $( echo "one two three" | awk '{ ORS=" "; i=1; while (i <= NF) {
print "\""$i"\"" ; i++ } }' ) )

What was wrong in the first one. Any ideer are welcome.. thx.

One more question, how does "fish" compare to "zsh"?


-- 
Mvh, Per Blomqvist
Web: http://phoohb.shellkonto.se
Telnr: +46 70-3355632



Messages sorted by: Reverse Date, Date, Thread, Author