04-25-2013
Comment on the original code.
You don't make use of $1 parameter so don't need $dir
Indeed you can use the inheritance of the current work directory - but you need to change it before the recursive call.
So do not restore it i.e. do not cd .. (you may but not need to do cd .. afterwards)
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm using the UNIX csh and i wish to use recursion to nav my way up (or down as it is) a given folder.
My little test script is called "r" and takes a folder as argv (or $1)
#!/bin/tcsh -f
set allFiles = `ls -A $argv`
cd $argv
while ($#allFiles)
if (-d... (1 Reply)
Discussion started by: gsjf
1 Replies
2. Shell Programming and Scripting
I am running a korn shell script which has a recursive function.
The script ran for 117 iterations and ended up with the following error
"recursion too deep".
what should be done to avert this?
Thanks in advance
Swamy
p.s. I am on UNIX MPRAS V4 (3 Replies)
Discussion started by: swamy455
3 Replies
3. Shell Programming and Scripting
Hello every body. I am trying to find the factorial using the following code. But it is giving the syntax error. I tried very much but in vain. Thanks in advance for helping me
factorial()
{
if
then
y=`expr $1 - 1`
x=$(( $1 \* factorial $y ))... (6 Replies)
Discussion started by: murtaza
6 Replies
4. Programming
I want to halt a tail recursive function after certain validation. I want to come out of entire recursion without unwinding phase. How can i achieve that . The coding is done in C language. (5 Replies)
Discussion started by: joshighanshyam
5 Replies
5. Shell Programming and Scripting
Hi Guys,,
I tried to create a recursive function in unix.
The following is the code.
#/bin/sh
function(){
n=$1;
if ; then
out=1;
echo "inside if for 0";
else
out = `$n * function "$n-1"`;
echo "inside if for $n-1;
fi (3 Replies)
Discussion started by: mac4rfree
3 Replies
6. Shell Programming and Scripting
I am facing problem with Shell script to generate Fibonacci series using recursion i.e. recursive function.
Here is my script:
#!/bin/sh
fibo()
{
no=$1
if ; then
return 0
elif ; then
return 1
else
a1=`expr $no - 1`
fibo $a1
... (10 Replies)
Discussion started by: Tapas Bose
10 Replies
7. Programming
Hi,
Question: how come the output is like that? Can explain to me abit. I am learning C.
Thanks!
#include <stdio.h>
#include <string.h>
void printit(char line_of_char, int index);
int main()
{
char line_of_char;
int index = -1;
strcpy(line_of_char, "This is a string.");
... (5 Replies)
Discussion started by: seede
5 Replies
8. Shell Programming and Scripting
Can someone please explain me why the following script calls it self recursively:
#!/bin/bash
echo Called
$0
while this not:
#!/bin/bash
echo Called
$($0)
Thanks (6 Replies)
Discussion started by: superpointer
6 Replies
9. Shell Programming and Scripting
Not sure how to ask this question. I want concatenate strings and variable recursively into new variable. For example:
infile01=/dir/subfolder/file01.txt
infile02=/dir/subfolder/file02.txt
infile03=/dir/subfolder/file03.txt
for i in {01..03}
do
u=${"infile"$i}
echo $u
doneI got error... (7 Replies)
Discussion started by: yifangt
7 Replies
10. Shell Programming and Scripting
I'm new to utilities like socat and netcat and I'm not clear if they will do what I need.
I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes.
I'm using Cygwin bash on Windows 10.
My... (3 Replies)
Discussion started by: siegfried
3 Replies
LEARN ABOUT DEBIAN
autoreconf2.13
AUTORECONF(1) General Commands Manual AUTORECONF(1)
NAME
autoreconf2.13 - update configure scripts
SYNOPSIS
autoreconf2.13 [ --help | -h ] [ --force | -f ] [ --localdir=dir | -l dir ] [ --macrodir=dir | -m dir ] [ --verbose ] [ --version ]
DESCRIPTION
If you have a lot of Autoconf-generated configure scripts, the autoreconf2.13 program can save you some work. It runs autoconf2.13 (and
autoheader2.13, where appropriate) repeatedly to remake the Autoconf configure scripts and configuration header templates in the directory
tree rooted at the current directory. By default, it only remakes those files that are older than their configure.in or (if present) aclo-
cal.m4. Since autoheader2.13 does not change the timestamp of its output file if the file wouldn't be changing, this is not necessarily
the minimum amount of work. If you install a new version of Autoconf, you can make autoreconf2.13 remake all of the files by giving it the
--force option.
If you give autoreconf2.13 the --macrodir=DIR or --localdir=DIR options, it passes them down to autoconf2.13 and autoheader2.13 (with rela-
tive paths adjusted properly).
autoreconf2.13 does not support having, in the same directory tree, both directories that are parts of a larger package (sharing aclocal.m4
and acconfig.h), and directories that are independent packages (each with their own aclocal.m4 and acconfig.h). It assumes that they are
all part of the same package, if you use --localdir, or that each directory is a separate package, if you don't use it. This restriction
may be removed in the future.
autoreconf2.13 accepts the following options:
--help
-h Print a summary of the command line options and exit.
--force
-f Remake even configure scripts and configuration headers that are newer than their input files (configure.in and, if present, aclo-
cal.m4).
--localdir=DIR
-l DIR Look for the package file aclocal.m4 in directory DIR instead of in the current directory.
--macrodir=DIR
-m DIR Look for the installed macro files in directory DIR. You can also set the AC_MACRODIR environment variable to a directory; this
option overrides the environment variable.
--verbose
Print the name of each directory where autoreconf2.13 runs autoconf2.13 (and autoheader2.13, if appropriate).
--version
Print the version number of Autoconf and exit.
SEE ALSO
autoconf2.13(1), autoheader2.13(1), autoscan2.13(1), autoupdate2.13(1), ifnames2.13(1)
AUTHORS
David MacKenzie, with help from Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, Roland McGrath, Noah Friedman, David D.
Zuhn, and many others. This manpage written by Ben Pfaff <pfaffben@debian.org> for the Debian GNU/Linux autoconf2.13 package.
Autoconf AUTORECONF(1)