Hi. Sure. Here it is. Just the same code with mkdir and an increment of the number variable. Works nicely up until the 10th iteration, then it just continuously creates num_10.
I don't see the purpose of extracting the variable base from $f. Given that you start by creating ${BASEDIR}/num_0 and strip off ${BASEDIR}/ and then strip off _0 (or _ followed by some other string of digits), isn't $base always going to expand to the string num?
And after you have created the 1st 11 directories in your sequence, the for loop:
will process those directory names in alphabetic order:
and when you exit the loop after processing num_9, the variable num will be set to 9.
You go to a lot of trouble in your loop to set the array element max["num"] to 10, but you don't use that when you create the next directory after you're done. Note that if there are any values for base other than the string num and you tried to use the value of $base after you get out of the loop, there would be a good chance that ${max[$base]} when you get out of the loop would be unrelated to the highest numeric value seen in the loop.
Maybe the following would come closer to what you're trying to do:
This User Gave Thanks to Don Cragun For This Post:
Hi
I got this part of the script from the mimetool by Perderabo.
I have difficulty in decyphering the syntax specially lines 4,5 & 9.
Also the test condition in line 3.
Could someone help me on this please.
--------------------------------------
pwentry=$(grep "^$(logname):" /etc/paswd)... (2 Replies)
Hi I am new to shell script programming...
want to know the process of the following:
if
then
echo "$0: missing argument for option(s) :$MISSINGOPTARG"
echo "usage" $USAGE"
exit 1
fi (1 Reply)
Could someone give me a quick simple explanation for the AWK command.
And also help me to explain the code i have made. I have made some general comments about it myself. I was wondering if people could help me with the rest:
awk -F'' 'END {
fmt = "%-20s\t%s\t%s\n" ... (0 Replies)
Hi
I have a line/command which greps certain pattern () from the file and 22 lines AFTER that:
nawk '/\/{c=22}c&&c--' input_file
Can somebody explain the coding in this command (what " c&&c-- " does)? and how to modify this command to output 22 lines BEFORE this pattern () Thanks a lot ... (3 Replies)
I have the following piece of codes. Please explain it to me in great detail how are these codes working.
1. #include <stdio.h>
int main(){
int x;
x=0;
while (x<2 && fork()){
if (!fork()) execlp("echo","x++","x",0);
x++;
system("echo x+x");
}
}
2.
#include <stdio.h>
int i;... (1 Reply)
Can you please explain the following code plz?
my_cd=' '
while getopts :e: OPTION;
do
case "$OPTION" in
e) my_cd ="$OPTARG";;
esac
done
if ; then
echo " >>> ERROR - I am wrong"
echo " >>> ERROR - Hello"
exit 99
fi
What I don't understand is what is OPTION or... (3 Replies)
hi all,
Can any 1 help me translate this korn shell code to C shell code :
email=$(grep "^$1" $folder/config_2.txt | awk '{print $2'})
In config_2.txt the content is :
which mean in korn shell , $1=groupname and $2=email address.
Now i need to write in C shell script,when i set the... (2 Replies)
Hi all,
I need your help in understanding the meaning and syntax of the below nawk line.
Here is an extract of a script which I use daily and works well. The script extracts the hostnames and messages within a syslog file. I would also like to extract the message time in the 3rd column by... (2 Replies)
I need someone to tell me how exactly works the following code αfter /etc/passwd :eek::
cat /etc/passwd|grep "^:"|sed '1,$s/^\(*\):*:\(*\):.*$/ \1 \2 /'|sort -nrk3 -t:I want a good explanation to understand the code please (4 Replies)
1. I've been asked to provide a detailed description on how Minix's source code is organised. This may sound slightly simple, but what exactly am I to refer to when explaining? Any documents that would provide assistance to understand whats being asked? Thanks
2. Not applicable:
3.... (1 Reply)