diff --git a/README.md b/README.md index 3d2090f..e37cea2 100644 --- a/README.md +++ b/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. diff --git a/cpy_pst/Makefile b/cpy_pst/Makefile new file mode 100644 index 0000000..33a9d9c --- /dev/null +++ b/cpy_pst/Makefile @@ -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 diff --git a/cpy_pst/README.md b/cpy_pst/README.md new file mode 100644 index 0000000..8d0355f --- /dev/null +++ b/cpy_pst/README.md @@ -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`` diff --git a/cpy_pst/cpy.sh b/cpy_pst/cpy.sh new file mode 100755 index 0000000..0ce6cb3 --- /dev/null +++ b/cpy_pst/cpy.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# This is a small script for copy pasting files and directories. +# +# Marcel Kapfer (mmk2410) +# +# 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< +# +# 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<