linux - How to use select with awk in bash script? -
i have write bash script university, text says:
write bash script allows root user, list of users of machine. selecting user, using select, required indicate directory (indicate absolute path). @ point in output have shown list of files folder owned user, ranked in ascending order according size of file.
to check if user root used:
if[ "$(id -u)" = 0 ];
to list of users of machine thinking of using awk:
awk -f':' '{ print$1}' /etc/passwd
how can use select awk? there way without using awk?
thank in advance
here way use awk in select statement, need finish rest homework (for example, sort result)
#!/usr/bin/env bash select user in $(awk -f ":" '{print $1}' /etc/passwd ) read -p "input absolute directory: " path find $path -type f -user "$user" -ls done
Comments
Post a Comment