2 Removed syntax highlighting since the * breaks it
source | link

You can use something similar to this:

#!/bin/bash

counter(){
    for file in "$1"/*
    do 
    if [ -d "$file" ]
    then 
            echo "$file"
            counter "$file"
    fi
    done
}

counter "$1"
#!/bin/bash

counter(){
    for file in "$1"/* 
    do 
    if [ -d "$file" ]
    then 
            echo "$file"
            counter "$file"
    fi
    done
}

counter "$1"

Run it as ./script.sh . to recursively print directories in under the current directory or give the path to some other directory to traverse.

You can use something similar to this:

#!/bin/bash

counter(){
    for file in "$1"/*
    do 
    if [ -d "$file" ]
    then 
            echo "$file"
            counter "$file"
    fi
    done
}

counter "$1"

Run it as ./script.sh . to recursively print directories in under the current directory or give the path to some other directory to traverse.

You can use something similar to this:

#!/bin/bash

counter(){
    for file in "$1"/* 
    do 
    if [ -d "$file" ]
    then 
            echo "$file"
            counter "$file"
    fi
    done
}

counter "$1"

Run it as ./script.sh . to recursively print directories in under the current directory or give the path to some other directory to traverse.

1
source | link

You can use something similar to this:

#!/bin/bash

counter(){
    for file in "$1"/*
    do 
    if [ -d "$file" ]
    then 
            echo "$file"
            counter "$file"
    fi
    done
}

counter "$1"

Run it as ./script.sh . to recursively print directories in under the current directory or give the path to some other directory to traverse.