cpy_pst script
This commit is contained in:
parent
6fb66cfe3f
commit
a0a86492ee
5 changed files with 156 additions and 0 deletions
17
README.md
17
README.md
|
@ -3,6 +3,8 @@ A collection of (useful) bash scripts for Linux.
|
|||
|
||||
## How to use
|
||||
|
||||
If nothing other is written, do this:
|
||||
|
||||
1. Download the script you want.
|
||||
2. Run ``chmod +x script.sh`` to make it executable
|
||||
3. Run it with ``./script.sh``
|
||||
|
@ -13,6 +15,21 @@ A script for automatically creating PDf files from a latex document. You can set
|
|||
|
||||
**Usage:** ``./buildpdf.sh filename [build amount] [time between builds in s]``
|
||||
|
||||
## cpy_pst
|
||||
|
||||
A small but useful script for copying and pasting files and directories once or more often.
|
||||
|
||||
**Install:** ``sudo make install``
|
||||
|
||||
**Usage:**
|
||||
|
||||
```
|
||||
cpy filename # Copies a file / directory
|
||||
pst filename # Pasts a file / directory
|
||||
```
|
||||
|
||||
**Remove:** ``sudo make uninstall``
|
||||
|
||||
## intellij-hidpi.sh
|
||||
|
||||
This is a small script for enabling and disabling HiDPI support on IntelliJ IDEA Community Edition on every Linux distribution where IntelliJ is installed in /usr/share/intellijidea-ce/. If the installation is somewhere else you have to change the variable IDEA_PATH.
|
||||
|
|
9
cpy_pst/Makefile
Normal file
9
cpy_pst/Makefile
Normal file
|
@ -0,0 +1,9 @@
|
|||
all:
|
||||
|
||||
install:
|
||||
cp cpy.sh /usr/bin/cpy
|
||||
cp pst.sh /usr/bin/pst
|
||||
|
||||
uninstall:
|
||||
rm /usr/bin/cpy
|
||||
rm /usr/bin/pst
|
14
cpy_pst/README.md
Normal file
14
cpy_pst/README.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
# cpy_pst
|
||||
|
||||
A small but useful script for copying and pasting files and directories once or more often.
|
||||
|
||||
**Install:** ``sudo make install``
|
||||
|
||||
**Usage:**
|
||||
|
||||
```
|
||||
cpy filename # Copies a file / directory
|
||||
pst filename # Pasts a file / directory
|
||||
```
|
||||
|
||||
**Remove:** ``sudo make uninstall``
|
60
cpy_pst/cpy.sh
Executable file
60
cpy_pst/cpy.sh
Executable file
|
@ -0,0 +1,60 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This is a small script for copy pasting files and directories.
|
||||
#
|
||||
# Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
|
||||
#
|
||||
# 15 August 2015
|
||||
#
|
||||
# GNU GPL v3
|
||||
#
|
||||
# Version: 0.1 -> feel free to redistribute or fork it
|
||||
|
||||
FILE=/tmp/cpypst
|
||||
|
||||
function copy {
|
||||
if [[ -d "$FILE" ]]; then
|
||||
rm -rf $FILE
|
||||
elif [[ -f "$FILE" ]]; then
|
||||
rm $FILE
|
||||
fi
|
||||
if [[ -d "$1" ]]; then
|
||||
cp -R $1 $FILE
|
||||
elif [[ -f "$1" ]]; then
|
||||
cp $1 $FILE
|
||||
fi
|
||||
}
|
||||
|
||||
usage=$(
|
||||
cat<<EOF
|
||||
COPY AND PASTE
|
||||
for the terminal
|
||||
|
||||
Usage: cpy args
|
||||
|
||||
-h | --help Prints this help text
|
||||
|
||||
mmk2410
|
||||
marcel-kapfer.de
|
||||
EOF
|
||||
)
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
echo
|
||||
echo "$usage"
|
||||
echo
|
||||
exit
|
||||
elif [[ -z "$2" ]]; then
|
||||
copy $1
|
||||
else
|
||||
until [[ $1 == -- ]]; do
|
||||
case $1 in
|
||||
-h | --help )
|
||||
echo
|
||||
echo "$usage"
|
||||
echo
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
56
cpy_pst/pst.sh
Executable file
56
cpy_pst/pst.sh
Executable file
|
@ -0,0 +1,56 @@
|
|||
#!/bin/bash
|
||||
|
||||
# A small script for copy pasting files and directories.
|
||||
#
|
||||
# Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
|
||||
#
|
||||
# 15 August 2015
|
||||
#
|
||||
# GNU GPL v3 -> feel free to re-distribute of fork it
|
||||
#
|
||||
# Version: 0.1
|
||||
|
||||
FILE=/tmp/cpypst
|
||||
|
||||
function paste {
|
||||
if [[ -d "$FILE" ]]; then
|
||||
cp -R "$FILE" "$1"
|
||||
elif [[ -f "$FILE" ]]; then
|
||||
cp $FILE $1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
usage=$(
|
||||
cat<<EOF
|
||||
COPY AND PASTE
|
||||
for the terminal
|
||||
|
||||
Usage: pst filename
|
||||
|
||||
-h | --help Prints this help text
|
||||
|
||||
mmk2410
|
||||
marcel-kapfer.de
|
||||
EOF
|
||||
)
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
echo
|
||||
echo "$usage"
|
||||
echo
|
||||
exit
|
||||
elif [[ -z "$2" ]]; then
|
||||
paste $1
|
||||
else
|
||||
until [[ $1 == -- ]]; do
|
||||
case $1 in
|
||||
-h | --help )
|
||||
echo
|
||||
echo "$usage"
|
||||
echo
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
Loading…
Reference in a new issue