#!/bin/bash if [ $# -ne 2 ] ; then echo "Usage: sudo mem_add " echo " Create the AlternC account having uid number " exit 1 fi name="$1" uid="$2" if [[ ! "$name" =~ ^([a-z0-9]+)$ ]] ; then echo "Account name is incorrect." exit 2 fi if [[ ! "$uid" =~ ^([0-9]+)$ ]] ; then echo "uid is incorrect." exit 3 fi if [[ ! "$(id -u)" == "0" ]] ; then echo "please launch mem_add as root (or using sudo)" exit 4 fi # Get the vars and some functions source /usr/lib/alternc/functions.sh target="$(get_html_path_by_name "$name")" mkdir -p "$target" chmod 2770 "$target" /usr/lib/alternc/fixperms.sh -u "$uid"