To understand concept of subshell, let us take an example
suppose we execute following command
root#pwd
/root
root#cd /opt/backup;pwd
output will be
/opt/backup
root# pwd
/opt/backup
Now try to execute following command
root# (cd /opt/backup;pwd)
/opt/backup
But
root#pwd
/root
We can notice the diffrence , in () causes sub-shell to be invoked, in
which change of directory in executed, after executing pwd in subshell
the sub shell ceases to exist. back in current shell , so we are still
suppose we execute following command
root#pwd
/root
root#cd /opt/backup;pwd
output will be
/opt/backup
root# pwd
/opt/backup
Now try to execute following command
root# (cd /opt/backup;pwd)
/opt/backup
But
root#pwd
/root
We can notice the diffrence , in () causes sub-shell to be invoked, in
which change of directory in executed, after executing pwd in subshell
the sub shell ceases to exist. back in current shell , so we are still
in /root