Skip to content

Instantly share code, notes, and snippets.

@maciektr
Created January 14, 2019 21:28
Show Gist options
  • Save maciektr/eaf4775b95c3ef2d01bb449da112759e to your computer and use it in GitHub Desktop.
Save maciektr/eaf4775b95c3ef2d01bb449da112759e to your computer and use it in GitHub Desktop.
Skrypt z laboratoriów z unixów
#!/bin/bash
if [ $# -eq 0 ]; then
echo -n "Podaj UIDs: "
read NUMERY
else
NUMERY=$*
fi
for NUM in $NUMERY; do
OPIS=`cat /etc/passwd | cut -d : -f 3,5 | grep "^$NUM:" | cut -d: -f2`
if [ "$OPIS" ]; then
echo "$NUM to $OPIS"
else
echo "$NUM opis pusty"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment