Skip to content
Snippets Groups Projects
Commit 8ed78a8f authored by leo.muff's avatar leo.muff
Browse files

init

parents
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
if [ $# -ne 1 ];then
echo "usage: ./get_groups username"
exit 1
fi
USER=$1
GID=$(cat /etc/passwd | grep -E ^$1: | cut -d ":" -f 3)
if [ "$GID" = "" ]; then
echo "user not found"
exit 1
else
MAIN_GROUP=$(cat /etc/group | grep $GID | cut -d ":" -f 1)
SEC_GROUPS=$(cat /etc/group | grep $1 | cut -d ":" -f 1 | sed s/"$MAIN_GROUP"//)
RES=$(echo $MAIN_GROUP $SEC_GROUPS )
echo $RES
fi
\ No newline at end of file
#!/bin/bash
if [ $# -ne 1 ];then
echo "usage: ./largest_file folder"
exit 1
fi
FILES=$(ls -R $1)
if [ $? -eq 1 ]; then
echo "folder not existing"
exit 1
fi
if [ "$FILES" = " " ]; then
echo "folder empty"
exit 1
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment