root/floppyfw/files/passwd.sh

Revision 1, 440 bytes (checked in by root, 6 years ago)

First post

Line 
1#!/bin/sh
2
3PW_F=./passwd
4PW_L=13
5
6PW="$1"
7
8[ "$PW" ] || {
9        echo "E: need a passwd argument"
10        exit 1                                         
11}
12
13[ ${#PW} -eq $PW_L ] || {
14        echo "E: passwd argument length must be $PW_L"
15        exit 1
16}
17
18# tweak the passwd file with fall back, in case of a problem ;-)
19mv $PW_F $PW_F.old
20if sed -e "s,^\(root\):[^:]*:\(.*\)$,\1:$PW:\2," $PW_F.old > $PW_F
21then
22        rm -f $PW_F.old
23else
24        mv $PW_F.old $PW_F
25fi
26
27exit 0
28
Note: See TracBrowser for help on using the browser.