Skip to main content
added 4 characters in body
Source Link
Asclepius
  • 466
  • 5
  • 9

This combines the answer by Serge with an unrelated answer by David. It changes the directory, and then instead of forcing a bash shell, it launches the user's default shelllaunches the user's default shell. It however requires both getent and /etc/passwd to detect the default shell.

#!/usr/bin/env bash cd desired/directory USER_SHELL=$(getent passwd <USER> | cut -d : -f 7) $USER_SHELL 

Of course this still has the same deficiency of creating a nested shell.

This combines the answer by Serge with an unrelated answer by David. It changes the directory, and then instead of forcing a bash shell, it launches the user's default shell. It however requires both getent and /etc/passwd to detect the default shell.

#!/usr/bin/env bash cd desired/directory USER_SHELL=$(getent passwd <USER> | cut -d : -f 7) $USER_SHELL 

Of course this still has the same deficiency of creating a nested shell.

This combines the answer by Serge with an unrelated answer by David. It changes the directory, and then instead of forcing a bash shell, it launches the user's default shell. It however requires both getent and /etc/passwd to detect the default shell.

#!/usr/bin/env bash cd desired/directory USER_SHELL=$(getent passwd <USER> | cut -d : -f 7) $USER_SHELL 

Of course this still has the same deficiency of creating a nested shell.

deleted 1 character in body
Source Link
Asclepius
  • 466
  • 5
  • 9

This combines the answer by Serge with an unrelated answer by David. It changes the directory, and then instead of forcing a bash shell, it useslaunches the user's default shell. It however requires both getent and /etc/passwd to detect the default shell.

#!/usr/bin/env bash cd desired/directory USER_SHELL=$(getent passwd <USER> | cut -d : -f 7) $USER_SHELL 

Of course this still has the same deficiency of creating a nested shell hell.

This combines the answer by Serge with an unrelated answer by David. It changes the directory, and then instead of forcing a bash shell, it uses the user's default shell. It however requires both getent and /etc/passwd to detect the default shell.

#!/usr/bin/env bash cd desired/directory USER_SHELL=$(getent passwd <USER> | cut -d : -f 7) $USER_SHELL 

Of course this still has the same deficiency of creating a nested shell hell.

This combines the answer by Serge with an unrelated answer by David. It changes the directory, and then instead of forcing a bash shell, it launches the user's default shell. It however requires both getent and /etc/passwd to detect the default shell.

#!/usr/bin/env bash cd desired/directory USER_SHELL=$(getent passwd <USER> | cut -d : -f 7) $USER_SHELL 

Of course this still has the same deficiency of creating a nested shell.

Source Link
Asclepius
  • 466
  • 5
  • 9

This combines the answer by Serge with an unrelated answer by David. It changes the directory, and then instead of forcing a bash shell, it uses the user's default shell. It however requires both getent and /etc/passwd to detect the default shell.

#!/usr/bin/env bash cd desired/directory USER_SHELL=$(getent passwd <USER> | cut -d : -f 7) $USER_SHELL 

Of course this still has the same deficiency of creating a nested shell hell.