From: Mattia Cabrini Date: Tue, 11 Feb 2025 21:33:26 +0000 (+0100) Subject: Procedured and README X-Git-Url: https://git.theboydaily.dev/mattia?a=commitdiff_plain;h=6eaf3a6eaef5e51eb5f0b327d19eaa9f00dda534;p=some.files.git Procedured and README --- diff --git a/.bashrc b/.bashrc index 73d46f4..e87042d 100644 --- a/.bashrc +++ b/.bashrc @@ -19,31 +19,6 @@ HISTFILESIZE=2000 # export PS1="\[\033[m\][\[\033[1;35m\]\t\[\033[m\]] \[\e[2m\]\u\[\e[1;36m\]\[\033[m\]@\[\e[1;36m\]\h\[\033[m\]:\[\e[0m\]\[\e[1;32m\]\W\[\e[0m\]\[\e[2m\]\$ \[\e[0m\]" -# -# # ex - archive extractor -# # usage: ex -ex () -{ - if [ -f $1 ] ; then - case $1 in - *.tar.bz2) tar -xvjf $1 ;; - *.tar.gz) tar -xvzf $1 ;; - *.bz2) bunzip2 $1 ;; - *.rar) unrar x $1 ;; - *.gz) gunzip $1 ;; - *.tar) tar -xvf $1 ;; - *.tbz2) tar -xvjf $1 ;; - *.tgz) tar -xvzf $1 ;; - *.zip) unzip $1 ;; - *.Z) uncompress $1;; - *.7z) 7z x $1 ;; - *) echo "'$1' cannot be extracted via ex()" ;; - esac - else - echo "'$1' is not a valid file" - fi -} - # User defined aliases if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases diff --git a/.config/some.files/bash/procedures/ex.sh b/.config/some.files/bash/procedures/ex.sh new file mode 100644 index 0000000..f98dcc3 --- /dev/null +++ b/.config/some.files/bash/procedures/ex.sh @@ -0,0 +1,23 @@ +# $1: file to extract +ex () +{ + if [ -f $1 ] ; then + case $1 in + *.tar.bz2) tar -xvjf $1 ;; + *.tar.gz) tar -xvzf $1 ;; + *.bz2) bunzip2 $1 ;; + *.rar) unrar x $1 ;; + *.gz) gunzip $1 ;; + *.tar) tar -xvf $1 ;; + *.tbz2) tar -xvjf $1 ;; + *.tgz) tar -xvzf $1 ;; + *.zip) unzip $1 ;; + *.Z) uncompress $1;; + *.7z) 7z x $1 ;; + *) echo "'$1' is not supported" ;; + esac + else + echo "'$1' is not a file" + fi +} + diff --git a/README.md b/README.md index 7d1df5b..2fc6be4 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,10 @@ In this repository I collect some of my personal .files. ## Shell(s) I use bash on Lunux and zsh on MacOS, therefore I have and RC for both of them. Their design are similar: they define a prompt and some simple functions and include: -- `~/.*sh_aliases`: a file in which the user can insert additional aliases without changing the RC file. Additional aliases are not included for non-interactive shells; -- `~/.*sh_env`: a file in which the user is supposed to insert the environment variables or exports without changing the RC file. Since every system is different, the file is not included in the repository. +- `~/.*sh_aliases`: it defines simple cross machine alases (evaluated from \*shrc); +- `~/.*sh_env`: contanins definitions for machine specific environment variables (evaluated from \*shrc); +- `~/.config/some.files/bash/env.sh`: contains definitions for cross machine environment variables (evaluated from .bashrc); +- `~/.config/some.files/bash/procedures/*.sh`: each file is evaluated from .bashrc and is supposed to contain definitions for bash procedures; ### Dependencies