User:Vvinogra: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Vvinogra (talk | contribs)
No edit summary
Vvinogra (talk | contribs)
Line 1: Line 1:
==Bash Quests==
==Bash Quests==


===Quest 12===
===Quest 12 kasutaja olemasolu testimine===
<source lang="bash">
<source lang="bash">
#!/bin/bash
#!/bin/bash
Line 16: Line 16:
</source>
</source>


===Quest 12===
===Quest 12 Grupi olemasolu testimine===
<source lang="bash">
<source lang="bash">
#!/bin/bash
#!/bin/bash

Revision as of 11:46, 11 May 2011

Bash Quests

Quest 12 kasutaja olemasolu testimine

#!/bin/bash
#Autor: Vadim Vinogradin A21, vvinogra@itcollege.ee
#Versioon 0.1
#Teha skript is_group.sh mis kontrollib, kas kasutaja eksisteerib.
KASUTAJA=$1
# kontrollib, kas kasutaja on olemas (kui jah - siis näitab "0", kui ei ole - "1")
if [ $(getent group $KASUTAJA ) ]; then
        echo "0"
else
echo "1"
fi

Quest 12 Grupi olemasolu testimine

#!/bin/bash
#Autor: Vadim Vinogradin A21, vvinogra@itcollege.ee
#Versioon 0.1
#Teha skript is_group.sh mis kontrollib, kas grupp eksisteerib.
GRUPP=$1
# kontrollib, kas grupp on olemas (kui jah - siis näitab "0", kui ei ole - "1")

if [ $(getent group $GRUPP ) ]; then
        echo "0"
else
echo "1"
fi