how to parse value of the variable

I have a variable which has a full path to the file, for example :
A=/t1/bin/f410pdb
Does anybody know the command to parce this variable and assign the result to 3 other variables so each subdirectory name will be in a new variable like this
B=t1
C=bin
D=f410pdb
Many thanks -A

> A=/t1/bin/f410pdb
> B=$(echo "$A" | cut -d"/" -f2)
> C=$(echo "$A" | cut -d"/" -f3)
> D=$(echo "$A" | cut -d"/" -f4)
> echo $A
/t1/bin/f410pdb
> echo $B
t1
> echo $C
bin
> echo $D
f410pdb

Thanks a lot -A

$ A=/t1/bin/f410pdb oIFS=$IFS IFS=/
$ set -- $A
$ IFS=$oIFS
$ echo $2
t1
$ echo $3
bin
$ echo $4
f410pdb

With Z-Shell:

$ A=/t1/bin/f410pdb a=(${(s:/:)A})
$ print $a[1]
t1
$ print $a[2]
bin
$ print $a[3]
f410pdb

The code works perfectly
Would you mind to explain what
oIFS=$IFS IFS=/ does. Cheers -A

Save the current Internal Field Separator in oIFS, set it temporarily to '/' so the shell can split the string, restore ASAP the standard value.
For more information:

man sh|less -pIFS
1 Like