bash - Maximum nested function level reached -
I have a directory hierarchy where the "root" directory contains a file named "text.txt". I want to search this "root" directory and since then it runs the command 'foo'. Here's what I currently have
# root directory detects root () {local root #Findup directory looks through directory hierarchy I'm sure it works Root = $ (Research text 2 text & gt; & amp; / dev / null) If [[$? -a 0]] To resonate "Root Not Found" to resonate 1EF echo root # Root directory runFoo () {foo push $ myDir 1 & gt; from inside local myDir myDir = $ (locateRoot) & Amp; / Dev / null foo $ @ popd 1 & gt; & Amp; However, whenever I run this program I:
/ Pre>
reached the maximum nested function level
What's wrong with me? I hope foo works is positive.
In the locateRoot
function you just echo
Only the content of root
, which is incorrect and your script seems too long to do some simple tasks. I give you a sample script which prints the path to the directory that contains the text.txt
file
#! / Bin / bash locateRoot () {var = $ (/ / -iname "text.txt") Print "% s \ n" "$ var"}
You can see the complete path in that file. You can execute your command like the script
cd $ var / //. Code>
Comments
Post a Comment