My script:
#!/usr/bin/env bash PATH=/home/user/example/foo/bar mkdir -p /tmp/backup$PATH
And now I want to get first folder of
You can try this awk command:
basedirectory=$(echo "$PATH" | awk -F "/" '{print $2}')
At this point basedirectory will be the string home Then you write:
basedirectory
rm -rf ./"$basedirectory"/