Skip to content

Commit 23dadd2

Browse files
committed
some scripts
1 parent 10d00df commit 23dadd2

5 files changed

+92
-0
lines changed

all_file_lower_case.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
for i in * ; do mv $i `echo $i | tr [A-Z] [a-z]` ; done

create-project.sh

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/sh
2+
3+
if [ -z `which git` ]; then
4+
echo 'You have to install git first.'
5+
return
6+
fi
7+
8+
template_path="$1"
9+
echo "Now we are going to create a new project for you".
10+
if [ -z "$template_path" ]; then
11+
echo "Enter the desired path of your new project dir:"
12+
read template_path
13+
fi
14+
15+
# switch to the new project dir
16+
cd "$template_path"
17+
# remove unnecessary files
18+
mv tmp/template/* .
19+
rm -rf tmp
20+
21+
echo
22+
echo Initializing your new project...
23+
24+
echo 'Enter the binary name of your program. This is the name of the binary flie installed to /usr/bin:'
25+
read bin_name
26+
if [ -z "$bin_name" ]; then
27+
echo 'Please enter a valid name.'
28+
return
29+
fi
30+
31+
echo 'Enter a human readable name of your program ':
32+
read prog_name
33+
if [ -z "$prog_name" ]; then
34+
echo 'Please enter a valid name.'
35+
return
36+
fi
37+
38+
echo 'Enter a short description for your program (such as "A tool to configure mouse and keyboard")':
39+
read prog_desc
40+
if [ -z "$prog_desc" ]; then
41+
echo 'Please enter a valid description.'
42+
return
43+
fi
44+
45+
bin_name_=`echo $bin_name | sed s/-/_/`_
46+
47+
for f in `ls ./configure.ac ./src/*.c ./src/*.am ./data/*.am ./data/*.in ./data/ui/*.am ./data/ui/*.in`; do
48+
sed -e s/template_/"$bin_name_"/ -e s/template/"$bin_name"/ -e s/Template/"$prog_name"/ -e "s/Template Description/$prog_desc/" "$f" > "$f".tmp
49+
mv "$f".tmp "$f"
50+
done
51+
52+
# rename files
53+
mv src/template.c src/"$bin_name".c
54+
mv data/template.desktop.in data/"$bin_name".desktop.in
55+
56+
# remove git files.
57+
rm -rf .git
58+
59+
echo Done!

git_all_add.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
read -p "Enter commit message: " comment;
4+
git add .
5+
echo "All files added"
6+
git commit -m $commit
7+
echo "Commit done"
8+
git push
9+
echo "Pushed"

remove_tmp_files.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# Remove all tmp files in dir
4+
# which end in ~
5+
6+
echo "Input dir in which remove all temp files: "
7+
read DIR;
8+
find "$DIR" -name "*~"
9+
echo "All temp files are removed"
10+

show_full_file_path.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
# Shows the full path of files
4+
# good for copy pasting and for when
5+
# listing the full paths is necessary.
6+
7+
for file in $(ls "$@"); do
8+
echo -n $(pwd)
9+
[[ $(pwd) != "/" ]] && echo -n /
10+
echo $file
11+
done

0 commit comments

Comments
 (0)