Hi,
i'm not an expert in bash and i have a question. is there a way to split a string on a sequence of characters rather than just one?
the idea is the following
this is not what this code actually does, but that's what i tried and wanted it to do. when i execute this, the string in workdir is actually split on all characters that match a character in "/split/"
tnx
i'm not an expert in bash and i have a question. is there a way to split a string on a sequence of characters rather than just one?
the idea is the following
Code:
workdir=`pwd` echo $workdir # /path/to/my/split/directory/i/want/ arr=$(echo $workdir | tr "/split/" "\n") echo $arr[0] # /path/to/my echo $arr[1] # directory/i/want/
tnx
Comment