-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebold
executable file
·45 lines (42 loc) · 938 Bytes
/
webold
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
server="http://uaf-7.t2.ucsd.edu/~cgeorge"
if [ "$1" == "--ucsb" ]
then
shift 1
ucsb="1"
server="http://hep.ucsb.edu/people/cag"
fi
#If a directory is specified
dir=""
if [ "$1" == "-d" ]
then
dir=$2
if [ ! -d ~/public_html/$dir ]; then mkdir -p ~/public_html/$dir; fi
n=0; for i in $@; do if [ "$n" -ge "2" ]; then args="$args $i"; fi; n=$(( $n + 1 )); done
echo $args
else
args=$@
fi
#Regular Workflow
for input in $args
do
inputName=`echo $input | tr '/' ' ' | awk '{print $NF}'`
echo $inputName
raw=${input%.*}
rawName=${inputName%.*}
ext=${input#*.}
if [ "$ext" == "sh" ]
then
tocopy="$tocopy $raw.txt"
echo "Posted at $server/$dir/$rawName.txt"
else
tocopy="$tocopy $input"
echo "Posted at $server/$dir/$inputName"
fi
done
if [ "$ucsb" == "1" ]
then
scp -r $tocopy cag@klong.physics.ucsb.edu:/www/htdocs/people/cag/$dir
else
cp -r $tocopy ~/public_html/$dir
fi