HI,
I would like to ask You about some good books or links where I can find information about shells, theoretical information.
I will be grateful if You can help me
And I have question about zsh loop
trivial script:
exec time is 10 sec
but for 500000 loops
exec time is 300 sec
Why for 500000 loops execution time is 300 seconds, it's only 5x 100000 loops it should be about 50 sec
In other shells it's OK
1. there is not a lot of 'shell theory'. Production shops almost always choose a POSIX-compliant shell: probably one of: ksh (ksh88 ksh93 zsh) bash. The reason for this is portability.
read ISO/IEC subsection 3 ISO/IEC 9945
This tells you how shells are 'meant to be' I dunno if that is theory or not.
2.
a. terminal i/o is slow, net traffic botlenecks may also be involved
try this on two large-ish files, use different files to circumvent file caching:
b. the primary cause of loops bogging is process creation. You are executing echo.
if it is /usr/bin/echo and not the shell builtin echo, every loop execs a whole new child process. This is a huge amount of overhead.
tells you whether the echo you ran is builtin or not.
We need more information on the platform and OS to give you anything more useful
Actually, I just now noticed the "zsh" part of the subject, checked and saw that zsh (which I have zero experience with) does have a "which" builti-in. My apologies, jim_mcnamara, for jumping the gun. I had assumed you were referring to the common (though I don't think posix standardized) which(1) executable found on most BSD and Linux systems.
I will leave my original post (which follows) as is, as I think it may prevent misunderstandings among those who (like me) do not use zsh.
---------- Posted at 12:35 PM ----------
Quote:
Originally Posted by jim mcnamara
tells you whether the echo you ran is builtin or not.
That's incorrect. which(1) will search $PATH directories for an executable. If it finds anything, it will always be an external executable.
Use type to see what is actually being run.
The first result from the type built-in is what the shell will actually use. There are ways to use something other than the first found option, read your shell's man page.
Also, on ksh variants, instead of type use whence (although it may have type aliased to whence -v already as a convenience):
Regards,
Alister
Hi all.
A course I am has Beginning C prescribed for our C++ work, but I am wondering, is this correct? Why not Beginning C++ by the same author? We code in C++ and learn C++, when starting a project in Code::Blocks we select C++.
I may just be confused.
Thanks for the help. (1 Reply)
Inside a zsh function, I create a local array with local -a arrayname and a local associative array with local -A arrayname.
I also can create an array using set, like this:
set -A arrayname value1 value2 value3In this form, I can not explicitly declare that an array is associative or... (2 Replies)
Hello.
I have some main directories.
For example :
/main_dir1
/main_dir2In main_dir2, I have a sub dir named sub_dir2-1 with 2 files in it ( file_2-1, file_2-2 )
/main_dir2sub_dir2-1file_2-1
file_2-2From "/main_dir1/A/B/C" I make a soft link
ln -s /main_dir2/sub_dir2-1 ... (6 Replies)
I have the following script running with nohup on one of my servers:
#!/bin/bash
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#set log number
#i=1
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#Check if log exits, if so incrememnt log number up so we don't clobber
#while... (8 Replies)
hi,
In bash,
$ bind -P | grep yank-last
yank-last-arg can be found on "\M-.", "\M-_".
this allows me to press ALT key and the period (.) to yank the last argument of
the previous command line into the current command line.
How can I get the same behavior in zsh ?
Thanks ... (0 Replies)
Hi,
I do not want to violate any rules, so thought to ask before posting any links.
Just to contribute to the forum: through surfing I found a link to download "Unix in a Nutshell" (*.chm) FREE.
I was wondering if I can post that link here.
Thanks
Hemang (5 Replies)
Is there a command that I can list, at once, all the links(path) of a give file ( including hard link and soft link)? If not, can it be down by writing a script? Thanks a lot.
(I know that pwd would only list one path.) (2 Replies)
I have come across the topic of changing shells, does that mean that all Unix operating systems comes with a variety of shells built in and its up to the user to select a shell of his/her choice? (2 Replies)