📅  最后修改于: 2023-12-03 14:41:44.646000             🧑  作者: Mango
In HP-UX, chsh
command is used to change the login shell of a user. However, there may be times when you need to find out the location of all the possible valid shells that can be used with chsh
. This could be helpful for a system admin to ensure the correct shell is used for the users and to avoid any compatibility issues.
This article will provide a Shell-Bash script to list all the possible shell paths that can be used with chsh
command in HP-UX.
#!/usr/bin/ksh
# Script: chshell.sh
# Author: YourName
# Purpose: List all shells in /etc/shells
for i in $(cat /etc/shells)
do
if [ -x "$i" ]
then
echo "$i"
fi
done
This Shell-Bash script will list all the shell paths found in /etc/shells
. It only lists those paths that have execution permission (-x
option) set. This is required as only executable shell paths can be used with chsh
command.
This script provides a simple way to list all the shell paths that can be used with chsh
command in HP-UX. As a system admin, it is important to ensure that the correct shell path is set for the user login to avoid compatibility issues.