Bash Split a String with a Path in it : <p>I have the follow Problem, my file '2018_08_18__Lysto BackUp.plist' looks like this:</p>

<pre><code>/volume1/02_public/3rd_Party_Apps/SPK_SCRIPTS/SynoDSApps/webapp/
/volume1/02_public/3rd_Party_Apps/SPK_SCRIPTS/SynoDSApps/webapp/exit_codes/
/volume1/02_public/3rd_Party_Apps/SPK_SCRIPTS/SynoDSApps/webapp/exit_codes/code_FUNC
/volume1/02_public/3rd_Party_Apps/SPK_SCRIPTS/SynoDSApps/webapp/exit_codes/code_SCRI
/volume1/02_public/3rd_Party_Apps/SPK_SCRIPTS/SynoDSApps/webapp/login/
/volume1/02_public/3rd_Party_Apps/SPK_SCRIPTS/SynoDSApps/webapp/login/check_appprivilege.php
/volume1/02_public/3rd_Party_Apps/SPK_SCRIPTS/SynoDSApps/webapp/login/check_login.php
/volume1/02_public/3rd_Party_Apps/SPK_SCRIPTS/SynoDSApps/webapp/login/privilege.php
/volume1/02_public/3rd_Party_Apps/SPK_SCRIPTS/SynoDSApps/webapp/scripte/
/volume1/02_public/3rd_Party_Apps/SPK_SCRIPTS/SynoDSApps/webapp/scripte/Lysto BackUp/
/volume1/02_public/3rd_Party_Apps/SPK_SCRIPTS/SynoDSApps/webapp/scripte/Lysto BackUp/sys
/volume1/02_public/3rd_Party_Apps/SPK_SCRIPTS/SynoDSApps/webapp/scripte/Lysto BackUp/sys_func
/volume1/02_public/3rd_Party_Apps/SPK_SCRIPTS/SynoDSApps/SSH_ERROR
</code></pre>

<p>i read the file with an for loop so i get every single lines in:</p>

<pre><code>mainDirectory
</code></pre>

<p>i need the output like this...
Count --> '6'</p>

<p>so i need an idea to count every single /*/</p>

<pre><code>1 --&gt; /volume1/
2 --&gt; 02_public/
3 --&gt; 3rd_Party_Apps/
4 --&gt; SPK_SCRIPTS/
5 --&gt; SynoDSApps/
6 --&gt; webapp/
</code></pre>

<p>in this case:</p>

<pre><code>/volume1/02_public/3rd_Party_Apps/SPK_SCRIPTS/SynoDSApps/webapp/scripte/Lysto BackUp/sys_func
</code></pre>

<p>i need only this count --> '8'</p>

<pre><code>1 --&gt; /volume1/
2 --&gt; 02_public/
3 --&gt; 3rd_Party_Apps/
4 --&gt; SPK_SCRIPTS/
5 --&gt; SynoDSApps/
6 --&gt; webapp/
7 --&gt; scripte/
8 --&gt; Lysto BackUp/
not in the count result --&gt; sys_func
</code></pre>

<p>I hope you Guys can Help me to fix my Problems....
i look for a result since one Week :(</p>
