Here is a simple shell script which would read a user input and return you the owner and group of the input path.
check_owner_and_group.sh
#!/bin/sh echo "Please enter a file/folder path:" read target_path echo "You have entered $target_path" if [ -e $target_path ]; then target_owner=$(stat -c %U $target_path) target_group=$(stat -c %G $target_path) echo "$target_path owner is: $target_owner" echo "$target_path group is: $target_group" else echo "$target_path is not a valid path" fi
Done =)
Reference:
Filed under: Shell Script Tagged: Linux, Shell Script
