I receive from the user a certain absolute filepath, and I want to create a variable that will be a string that won't include only the FIRST two components of the file path, but without printing it or anything.
For example, the absolute path could be:
/home/myusername/folder1/folder2/folder3
And it's saved in "target_path", and I want "mydir" to be only:
/folder1/folder2/folder3
I tried using the cut command in different ways but without success.
/home/username
the actual$HOME
directory of the invoking user? if so you could remove it simply usingmydir="${target_path#$HOME}"
I think