Bash: “bad interpreter: Too many levels of symbolic links” Error

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












Recently I made a bash executable file with permissions 722 as I am almost perpetually root. The contents of the file are as follows:



#!/home/nolan/Documents/test/listFiles

[ $# -lt 1 ] && dirFocus = "" || dirFocus = $1
dirSize=$(ls -a $dirFocus | wc -w)

for ((a = 1; a <= $dirSize; a++)) ; do
i = 1
for ITEM in $(ls -a $dirFocus); do
declare -i i
declare -i a
if [ $a -eq $i ]; then
echo "$a : $ITEM"
fi
i = $[ $i + 1 ]
done
done


When run in terminal using:



root @ /home/nolan/Documents/test: bash listFiles
1 : .
2 : ..
3 : apple
4 : dirCheck
5 : ifTest
6 : ifTest.txt
7 : listFiles
8 : myscript
9 : nolan.txt
10 : pointer_to_apple
11 : scriptx.sh
12 : Stuff
13 : weekend
14 : weekend2
15 : weekend3


I receive this outcome as expected.
However the second I do:



root @ /home/nolan/Documents/test: ./listFiles
bash: ./listFiles: /home/nolan/Documents/test/listFiles: bad interpreter: Too
many levels of symbolic links


Is the error I get.
What exactly is going wrong? I've checked other forums but they don't seem to pertain to my situation.










share|improve this question























  • The first sentence of the question contains a falsehood, which is of course the basis of an answer.
    – JdeBP
    Aug 10 at 16:54






  • 2




    722 permissions seem wrong. You want to give the world write permission?
    – glenn jackman
    Aug 10 at 18:15














up vote
1
down vote

favorite












Recently I made a bash executable file with permissions 722 as I am almost perpetually root. The contents of the file are as follows:



#!/home/nolan/Documents/test/listFiles

[ $# -lt 1 ] && dirFocus = "" || dirFocus = $1
dirSize=$(ls -a $dirFocus | wc -w)

for ((a = 1; a <= $dirSize; a++)) ; do
i = 1
for ITEM in $(ls -a $dirFocus); do
declare -i i
declare -i a
if [ $a -eq $i ]; then
echo "$a : $ITEM"
fi
i = $[ $i + 1 ]
done
done


When run in terminal using:



root @ /home/nolan/Documents/test: bash listFiles
1 : .
2 : ..
3 : apple
4 : dirCheck
5 : ifTest
6 : ifTest.txt
7 : listFiles
8 : myscript
9 : nolan.txt
10 : pointer_to_apple
11 : scriptx.sh
12 : Stuff
13 : weekend
14 : weekend2
15 : weekend3


I receive this outcome as expected.
However the second I do:



root @ /home/nolan/Documents/test: ./listFiles
bash: ./listFiles: /home/nolan/Documents/test/listFiles: bad interpreter: Too
many levels of symbolic links


Is the error I get.
What exactly is going wrong? I've checked other forums but they don't seem to pertain to my situation.










share|improve this question























  • The first sentence of the question contains a falsehood, which is of course the basis of an answer.
    – JdeBP
    Aug 10 at 16:54






  • 2




    722 permissions seem wrong. You want to give the world write permission?
    – glenn jackman
    Aug 10 at 18:15












up vote
1
down vote

favorite









up vote
1
down vote

favorite











Recently I made a bash executable file with permissions 722 as I am almost perpetually root. The contents of the file are as follows:



#!/home/nolan/Documents/test/listFiles

[ $# -lt 1 ] && dirFocus = "" || dirFocus = $1
dirSize=$(ls -a $dirFocus | wc -w)

for ((a = 1; a <= $dirSize; a++)) ; do
i = 1
for ITEM in $(ls -a $dirFocus); do
declare -i i
declare -i a
if [ $a -eq $i ]; then
echo "$a : $ITEM"
fi
i = $[ $i + 1 ]
done
done


When run in terminal using:



root @ /home/nolan/Documents/test: bash listFiles
1 : .
2 : ..
3 : apple
4 : dirCheck
5 : ifTest
6 : ifTest.txt
7 : listFiles
8 : myscript
9 : nolan.txt
10 : pointer_to_apple
11 : scriptx.sh
12 : Stuff
13 : weekend
14 : weekend2
15 : weekend3


I receive this outcome as expected.
However the second I do:



root @ /home/nolan/Documents/test: ./listFiles
bash: ./listFiles: /home/nolan/Documents/test/listFiles: bad interpreter: Too
many levels of symbolic links


Is the error I get.
What exactly is going wrong? I've checked other forums but they don't seem to pertain to my situation.










share|improve this question















Recently I made a bash executable file with permissions 722 as I am almost perpetually root. The contents of the file are as follows:



#!/home/nolan/Documents/test/listFiles

[ $# -lt 1 ] && dirFocus = "" || dirFocus = $1
dirSize=$(ls -a $dirFocus | wc -w)

for ((a = 1; a <= $dirSize; a++)) ; do
i = 1
for ITEM in $(ls -a $dirFocus); do
declare -i i
declare -i a
if [ $a -eq $i ]; then
echo "$a : $ITEM"
fi
i = $[ $i + 1 ]
done
done


When run in terminal using:



root @ /home/nolan/Documents/test: bash listFiles
1 : .
2 : ..
3 : apple
4 : dirCheck
5 : ifTest
6 : ifTest.txt
7 : listFiles
8 : myscript
9 : nolan.txt
10 : pointer_to_apple
11 : scriptx.sh
12 : Stuff
13 : weekend
14 : weekend2
15 : weekend3


I receive this outcome as expected.
However the second I do:



root @ /home/nolan/Documents/test: ./listFiles
bash: ./listFiles: /home/nolan/Documents/test/listFiles: bad interpreter: Too
many levels of symbolic links


Is the error I get.
What exactly is going wrong? I've checked other forums but they don't seem to pertain to my situation.







linux bash






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 10 at 17:28









Kevin Kruse

339111




339111










asked Aug 10 at 16:45









NolanRudolph

163




163











  • The first sentence of the question contains a falsehood, which is of course the basis of an answer.
    – JdeBP
    Aug 10 at 16:54






  • 2




    722 permissions seem wrong. You want to give the world write permission?
    – glenn jackman
    Aug 10 at 18:15
















  • The first sentence of the question contains a falsehood, which is of course the basis of an answer.
    – JdeBP
    Aug 10 at 16:54






  • 2




    722 permissions seem wrong. You want to give the world write permission?
    – glenn jackman
    Aug 10 at 18:15















The first sentence of the question contains a falsehood, which is of course the basis of an answer.
– JdeBP
Aug 10 at 16:54




The first sentence of the question contains a falsehood, which is of course the basis of an answer.
– JdeBP
Aug 10 at 16:54




2




2




722 permissions seem wrong. You want to give the world write permission?
– glenn jackman
Aug 10 at 18:15




722 permissions seem wrong. You want to give the world write permission?
– glenn jackman
Aug 10 at 18:15










2 Answers
2






active

oldest

votes

















up vote
9
down vote













The first line of a script is the "shebang" line. It tells kernel (program loader) what program to run to interpret the script. Your script tries to run itself to interpret the script, which in turn calls itself to interpret the interpreter, and so on ad infinity.



When you run the script with bash filename, the kernel isn't invoked and bash is used to run the script which works.



Put



#! /bin/bash


to the first line and all will be fine.



BTW, create a user with limited privileges to experiment with the system. As root, you can easily destroy everything beyond repair.






share|improve this answer


















  • 1




    That something continues ad infinitum is not a very good explanation of why it stops immediately with an error. (-:
    – JdeBP
    Aug 10 at 16:56










  • @JdeBP "Ad finem" then?
    – Kusalananda
    Aug 10 at 17:41










  • It doesn't error out immediately, "Linux allows at most BINPRM_MAX_RECURSION, that is 4, levels of nesting." (git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/… , though that's different in current versions, might be this part: git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/… ).
    – ilkkachu
    Aug 10 at 19:57











  • That's immediate as far as the questioner is concerned, who described the behaviour as happening "the second" that xe attempted this. You're also looking at the wrong code in that first. ENOEXEC is not the error in the question.
    – JdeBP
    Aug 11 at 0:34

















up vote
4
down vote













choroba explained very well that your issue is with the shell script using itself as interpreter instead of bash.



Here's a suggestion for reimplementation of your script that



  1. Does not contain syntax errors (dirFocus = "" is, for example, a syntax error in that = should have no spaces around it in an assignment).


  2. Deals with filenames that have spaces and newlines (looping over the output of ls disqualifies any such filename, likewise wc -w would get the wrong count if any filename contained spaces).


  3. Uses modern shell syntax ($[ $i + 1 ] is obsolete bash syntax).


  4. Introduces tiny improvement in output (adds (dir) to directory names).


#!/bin/bash

shopt -s dotglob # make wildcards match hidden names by default
shopt -s nullglob # make wildcards expand to nothing if no match

count=0
for name in "$1:-."/*; do
count=$(( count + 1 ))
if [ -d "$name" ]; then
printf '%d : %s (dir)n' "$count" "$name##*/"
else
printf '%d : %sn' "$count" "$name##*/"
fi
done


This also does not expand the file list more than once, whereas your code does an ls on the whole directory for each name in the directory.



$1:-. means "use what's in $1 unless it's empty or unset, otherwise use .".



$name##*/ means "the string in $name, but without the bit up to the last /".






share|improve this answer






















  • Thanks a lot man, this does wonders for me and my future scripts! I was playing around with one part I didn't understand, namely after "$1:-." where it's followed by /* ... what purpose does /* serve here? I get that if there's no parameter, then replace with "." but what does "./*" signify?
    – NolanRudolph
    Aug 11 at 4:39










  • @NolanRudolph * is a filename globbing character that matches any string in a filename, so the complete thing, $1:-./* expands to all filenames in the directory given by the first command line argument, or to all filenames in the current directory if no command line argument was given.
    – Kusalananda
    Aug 11 at 6:02










  • Awesome, thank you so much :D
    – NolanRudolph
    Aug 11 at 8:08










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f461850%2fbash-bad-interpreter-too-many-levels-of-symbolic-links-error%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
9
down vote













The first line of a script is the "shebang" line. It tells kernel (program loader) what program to run to interpret the script. Your script tries to run itself to interpret the script, which in turn calls itself to interpret the interpreter, and so on ad infinity.



When you run the script with bash filename, the kernel isn't invoked and bash is used to run the script which works.



Put



#! /bin/bash


to the first line and all will be fine.



BTW, create a user with limited privileges to experiment with the system. As root, you can easily destroy everything beyond repair.






share|improve this answer


















  • 1




    That something continues ad infinitum is not a very good explanation of why it stops immediately with an error. (-:
    – JdeBP
    Aug 10 at 16:56










  • @JdeBP "Ad finem" then?
    – Kusalananda
    Aug 10 at 17:41










  • It doesn't error out immediately, "Linux allows at most BINPRM_MAX_RECURSION, that is 4, levels of nesting." (git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/… , though that's different in current versions, might be this part: git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/… ).
    – ilkkachu
    Aug 10 at 19:57











  • That's immediate as far as the questioner is concerned, who described the behaviour as happening "the second" that xe attempted this. You're also looking at the wrong code in that first. ENOEXEC is not the error in the question.
    – JdeBP
    Aug 11 at 0:34














up vote
9
down vote













The first line of a script is the "shebang" line. It tells kernel (program loader) what program to run to interpret the script. Your script tries to run itself to interpret the script, which in turn calls itself to interpret the interpreter, and so on ad infinity.



When you run the script with bash filename, the kernel isn't invoked and bash is used to run the script which works.



Put



#! /bin/bash


to the first line and all will be fine.



BTW, create a user with limited privileges to experiment with the system. As root, you can easily destroy everything beyond repair.






share|improve this answer


















  • 1




    That something continues ad infinitum is not a very good explanation of why it stops immediately with an error. (-:
    – JdeBP
    Aug 10 at 16:56










  • @JdeBP "Ad finem" then?
    – Kusalananda
    Aug 10 at 17:41










  • It doesn't error out immediately, "Linux allows at most BINPRM_MAX_RECURSION, that is 4, levels of nesting." (git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/… , though that's different in current versions, might be this part: git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/… ).
    – ilkkachu
    Aug 10 at 19:57











  • That's immediate as far as the questioner is concerned, who described the behaviour as happening "the second" that xe attempted this. You're also looking at the wrong code in that first. ENOEXEC is not the error in the question.
    – JdeBP
    Aug 11 at 0:34












up vote
9
down vote










up vote
9
down vote









The first line of a script is the "shebang" line. It tells kernel (program loader) what program to run to interpret the script. Your script tries to run itself to interpret the script, which in turn calls itself to interpret the interpreter, and so on ad infinity.



When you run the script with bash filename, the kernel isn't invoked and bash is used to run the script which works.



Put



#! /bin/bash


to the first line and all will be fine.



BTW, create a user with limited privileges to experiment with the system. As root, you can easily destroy everything beyond repair.






share|improve this answer














The first line of a script is the "shebang" line. It tells kernel (program loader) what program to run to interpret the script. Your script tries to run itself to interpret the script, which in turn calls itself to interpret the interpreter, and so on ad infinity.



When you run the script with bash filename, the kernel isn't invoked and bash is used to run the script which works.



Put



#! /bin/bash


to the first line and all will be fine.



BTW, create a user with limited privileges to experiment with the system. As root, you can easily destroy everything beyond repair.







share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 10 at 16:56

























answered Aug 10 at 16:50









choroba

24.5k34168




24.5k34168







  • 1




    That something continues ad infinitum is not a very good explanation of why it stops immediately with an error. (-:
    – JdeBP
    Aug 10 at 16:56










  • @JdeBP "Ad finem" then?
    – Kusalananda
    Aug 10 at 17:41










  • It doesn't error out immediately, "Linux allows at most BINPRM_MAX_RECURSION, that is 4, levels of nesting." (git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/… , though that's different in current versions, might be this part: git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/… ).
    – ilkkachu
    Aug 10 at 19:57











  • That's immediate as far as the questioner is concerned, who described the behaviour as happening "the second" that xe attempted this. You're also looking at the wrong code in that first. ENOEXEC is not the error in the question.
    – JdeBP
    Aug 11 at 0:34












  • 1




    That something continues ad infinitum is not a very good explanation of why it stops immediately with an error. (-:
    – JdeBP
    Aug 10 at 16:56










  • @JdeBP "Ad finem" then?
    – Kusalananda
    Aug 10 at 17:41










  • It doesn't error out immediately, "Linux allows at most BINPRM_MAX_RECURSION, that is 4, levels of nesting." (git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/… , though that's different in current versions, might be this part: git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/… ).
    – ilkkachu
    Aug 10 at 19:57











  • That's immediate as far as the questioner is concerned, who described the behaviour as happening "the second" that xe attempted this. You're also looking at the wrong code in that first. ENOEXEC is not the error in the question.
    – JdeBP
    Aug 11 at 0:34







1




1




That something continues ad infinitum is not a very good explanation of why it stops immediately with an error. (-:
– JdeBP
Aug 10 at 16:56




That something continues ad infinitum is not a very good explanation of why it stops immediately with an error. (-:
– JdeBP
Aug 10 at 16:56












@JdeBP "Ad finem" then?
– Kusalananda
Aug 10 at 17:41




@JdeBP "Ad finem" then?
– Kusalananda
Aug 10 at 17:41












It doesn't error out immediately, "Linux allows at most BINPRM_MAX_RECURSION, that is 4, levels of nesting." (git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/… , though that's different in current versions, might be this part: git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/… ).
– ilkkachu
Aug 10 at 19:57





It doesn't error out immediately, "Linux allows at most BINPRM_MAX_RECURSION, that is 4, levels of nesting." (git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/… , though that's different in current versions, might be this part: git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/… ).
– ilkkachu
Aug 10 at 19:57













That's immediate as far as the questioner is concerned, who described the behaviour as happening "the second" that xe attempted this. You're also looking at the wrong code in that first. ENOEXEC is not the error in the question.
– JdeBP
Aug 11 at 0:34




That's immediate as far as the questioner is concerned, who described the behaviour as happening "the second" that xe attempted this. You're also looking at the wrong code in that first. ENOEXEC is not the error in the question.
– JdeBP
Aug 11 at 0:34












up vote
4
down vote













choroba explained very well that your issue is with the shell script using itself as interpreter instead of bash.



Here's a suggestion for reimplementation of your script that



  1. Does not contain syntax errors (dirFocus = "" is, for example, a syntax error in that = should have no spaces around it in an assignment).


  2. Deals with filenames that have spaces and newlines (looping over the output of ls disqualifies any such filename, likewise wc -w would get the wrong count if any filename contained spaces).


  3. Uses modern shell syntax ($[ $i + 1 ] is obsolete bash syntax).


  4. Introduces tiny improvement in output (adds (dir) to directory names).


#!/bin/bash

shopt -s dotglob # make wildcards match hidden names by default
shopt -s nullglob # make wildcards expand to nothing if no match

count=0
for name in "$1:-."/*; do
count=$(( count + 1 ))
if [ -d "$name" ]; then
printf '%d : %s (dir)n' "$count" "$name##*/"
else
printf '%d : %sn' "$count" "$name##*/"
fi
done


This also does not expand the file list more than once, whereas your code does an ls on the whole directory for each name in the directory.



$1:-. means "use what's in $1 unless it's empty or unset, otherwise use .".



$name##*/ means "the string in $name, but without the bit up to the last /".






share|improve this answer






















  • Thanks a lot man, this does wonders for me and my future scripts! I was playing around with one part I didn't understand, namely after "$1:-." where it's followed by /* ... what purpose does /* serve here? I get that if there's no parameter, then replace with "." but what does "./*" signify?
    – NolanRudolph
    Aug 11 at 4:39










  • @NolanRudolph * is a filename globbing character that matches any string in a filename, so the complete thing, $1:-./* expands to all filenames in the directory given by the first command line argument, or to all filenames in the current directory if no command line argument was given.
    – Kusalananda
    Aug 11 at 6:02










  • Awesome, thank you so much :D
    – NolanRudolph
    Aug 11 at 8:08














up vote
4
down vote













choroba explained very well that your issue is with the shell script using itself as interpreter instead of bash.



Here's a suggestion for reimplementation of your script that



  1. Does not contain syntax errors (dirFocus = "" is, for example, a syntax error in that = should have no spaces around it in an assignment).


  2. Deals with filenames that have spaces and newlines (looping over the output of ls disqualifies any such filename, likewise wc -w would get the wrong count if any filename contained spaces).


  3. Uses modern shell syntax ($[ $i + 1 ] is obsolete bash syntax).


  4. Introduces tiny improvement in output (adds (dir) to directory names).


#!/bin/bash

shopt -s dotglob # make wildcards match hidden names by default
shopt -s nullglob # make wildcards expand to nothing if no match

count=0
for name in "$1:-."/*; do
count=$(( count + 1 ))
if [ -d "$name" ]; then
printf '%d : %s (dir)n' "$count" "$name##*/"
else
printf '%d : %sn' "$count" "$name##*/"
fi
done


This also does not expand the file list more than once, whereas your code does an ls on the whole directory for each name in the directory.



$1:-. means "use what's in $1 unless it's empty or unset, otherwise use .".



$name##*/ means "the string in $name, but without the bit up to the last /".






share|improve this answer






















  • Thanks a lot man, this does wonders for me and my future scripts! I was playing around with one part I didn't understand, namely after "$1:-." where it's followed by /* ... what purpose does /* serve here? I get that if there's no parameter, then replace with "." but what does "./*" signify?
    – NolanRudolph
    Aug 11 at 4:39










  • @NolanRudolph * is a filename globbing character that matches any string in a filename, so the complete thing, $1:-./* expands to all filenames in the directory given by the first command line argument, or to all filenames in the current directory if no command line argument was given.
    – Kusalananda
    Aug 11 at 6:02










  • Awesome, thank you so much :D
    – NolanRudolph
    Aug 11 at 8:08












up vote
4
down vote










up vote
4
down vote









choroba explained very well that your issue is with the shell script using itself as interpreter instead of bash.



Here's a suggestion for reimplementation of your script that



  1. Does not contain syntax errors (dirFocus = "" is, for example, a syntax error in that = should have no spaces around it in an assignment).


  2. Deals with filenames that have spaces and newlines (looping over the output of ls disqualifies any such filename, likewise wc -w would get the wrong count if any filename contained spaces).


  3. Uses modern shell syntax ($[ $i + 1 ] is obsolete bash syntax).


  4. Introduces tiny improvement in output (adds (dir) to directory names).


#!/bin/bash

shopt -s dotglob # make wildcards match hidden names by default
shopt -s nullglob # make wildcards expand to nothing if no match

count=0
for name in "$1:-."/*; do
count=$(( count + 1 ))
if [ -d "$name" ]; then
printf '%d : %s (dir)n' "$count" "$name##*/"
else
printf '%d : %sn' "$count" "$name##*/"
fi
done


This also does not expand the file list more than once, whereas your code does an ls on the whole directory for each name in the directory.



$1:-. means "use what's in $1 unless it's empty or unset, otherwise use .".



$name##*/ means "the string in $name, but without the bit up to the last /".






share|improve this answer














choroba explained very well that your issue is with the shell script using itself as interpreter instead of bash.



Here's a suggestion for reimplementation of your script that



  1. Does not contain syntax errors (dirFocus = "" is, for example, a syntax error in that = should have no spaces around it in an assignment).


  2. Deals with filenames that have spaces and newlines (looping over the output of ls disqualifies any such filename, likewise wc -w would get the wrong count if any filename contained spaces).


  3. Uses modern shell syntax ($[ $i + 1 ] is obsolete bash syntax).


  4. Introduces tiny improvement in output (adds (dir) to directory names).


#!/bin/bash

shopt -s dotglob # make wildcards match hidden names by default
shopt -s nullglob # make wildcards expand to nothing if no match

count=0
for name in "$1:-."/*; do
count=$(( count + 1 ))
if [ -d "$name" ]; then
printf '%d : %s (dir)n' "$count" "$name##*/"
else
printf '%d : %sn' "$count" "$name##*/"
fi
done


This also does not expand the file list more than once, whereas your code does an ls on the whole directory for each name in the directory.



$1:-. means "use what's in $1 unless it's empty or unset, otherwise use .".



$name##*/ means "the string in $name, but without the bit up to the last /".







share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 11 at 8:45

























answered Aug 10 at 18:05









Kusalananda

106k14209327




106k14209327











  • Thanks a lot man, this does wonders for me and my future scripts! I was playing around with one part I didn't understand, namely after "$1:-." where it's followed by /* ... what purpose does /* serve here? I get that if there's no parameter, then replace with "." but what does "./*" signify?
    – NolanRudolph
    Aug 11 at 4:39










  • @NolanRudolph * is a filename globbing character that matches any string in a filename, so the complete thing, $1:-./* expands to all filenames in the directory given by the first command line argument, or to all filenames in the current directory if no command line argument was given.
    – Kusalananda
    Aug 11 at 6:02










  • Awesome, thank you so much :D
    – NolanRudolph
    Aug 11 at 8:08
















  • Thanks a lot man, this does wonders for me and my future scripts! I was playing around with one part I didn't understand, namely after "$1:-." where it's followed by /* ... what purpose does /* serve here? I get that if there's no parameter, then replace with "." but what does "./*" signify?
    – NolanRudolph
    Aug 11 at 4:39










  • @NolanRudolph * is a filename globbing character that matches any string in a filename, so the complete thing, $1:-./* expands to all filenames in the directory given by the first command line argument, or to all filenames in the current directory if no command line argument was given.
    – Kusalananda
    Aug 11 at 6:02










  • Awesome, thank you so much :D
    – NolanRudolph
    Aug 11 at 8:08















Thanks a lot man, this does wonders for me and my future scripts! I was playing around with one part I didn't understand, namely after "$1:-." where it's followed by /* ... what purpose does /* serve here? I get that if there's no parameter, then replace with "." but what does "./*" signify?
– NolanRudolph
Aug 11 at 4:39




Thanks a lot man, this does wonders for me and my future scripts! I was playing around with one part I didn't understand, namely after "$1:-." where it's followed by /* ... what purpose does /* serve here? I get that if there's no parameter, then replace with "." but what does "./*" signify?
– NolanRudolph
Aug 11 at 4:39












@NolanRudolph * is a filename globbing character that matches any string in a filename, so the complete thing, $1:-./* expands to all filenames in the directory given by the first command line argument, or to all filenames in the current directory if no command line argument was given.
– Kusalananda
Aug 11 at 6:02




@NolanRudolph * is a filename globbing character that matches any string in a filename, so the complete thing, $1:-./* expands to all filenames in the directory given by the first command line argument, or to all filenames in the current directory if no command line argument was given.
– Kusalananda
Aug 11 at 6:02












Awesome, thank you so much :D
– NolanRudolph
Aug 11 at 8:08




Awesome, thank you so much :D
– NolanRudolph
Aug 11 at 8:08

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f461850%2fbash-bad-interpreter-too-many-levels-of-symbolic-links-error%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)