Question: I have two python scrips (direct.py and nat.py) and I would like to make a bash script to select which python to start based on my input.

Also, when manually running those py scripts I have input options (0...8,h and q). 
When press 'q' I have sys.exit().

eg:

```
./start.sh and output should be something like:
Chose your mode: (if type nat)
python3 nat.py

```

now python script is displayed and if press q, back to bash to chose option.

Answer: 
You already mention `cut`. You just set the delimiter to `/`. The somewhat unintuitive part is that you need fields 1-5, because the part before the first `/` is also counted as an (empty) field.

```
echo /1/2/3/4/5/6/7 | cut -d/ -f1-5

```

Result is

```
/1/2/3/4

```
You might want to consider (double) "parameter expansion: Remove matching prefix/suffix pattern":

```
$ path=/home/[username]/public_html/[prjectname]/abc/xyz
$ echo "${path%"${path#/*/*/*/*/}"}"
/home/[username]/public_html/[prjectname]/

```

No external command needed.