Last active
August 29, 2015 14:22
-
-
Save rnkn/c8b45543f167312b6ce6 to your computer and use it in GitHub Desktop.
txtdir.net script for adding friends links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
usage="Usage: addfriend friend1 [friend2 ...]" | |
friendsdir=$HOME/public/friends | |
if [ ! -d $friendsdir ] | |
then | |
echo "Making friends directory..." | |
mkdir -pv $friendsdir | |
fi | |
if [ $# > 0 ] | |
then | |
echo "Linking friends..." | |
for friend in $@ | |
do | |
if [ $(id -un $friend) ] | |
then | |
ln -shv $WORLD/$friend $friendsdir/$friend | |
fi | |
done | |
else | |
echo $usage | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment