From e044808d178d410855ecb873a371bb471b6a0efc Mon Sep 17 00:00:00 2001 From: Matthew Bennett Date: Sun, 18 Oct 2020 20:15:15 +0200 Subject: [PATCH] Updated Examples (markdown) --- Examples.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Examples.md b/Examples.md index fe9d378..0f72901 100644 --- a/Examples.md +++ b/Examples.md @@ -167,23 +167,23 @@ f() { # ADD A REPEATABLE COMMAND TO THE BASH HISTORY ############################ # Store the arguments in a temporary file for sanitising before being # entered into bash history - : > ~/.fzf_tmp + : > /tmp/fzf_tmp for file in ${arguments[@]}; do - echo $file >> ~/.fzf_tmp + echo $file >> /tmp/fzf_tmp done # Put all input arguments on one line and sanitise the command such that # spaces and parentheses are properly escaped. More sanitisation # substitutions can be added if needed - sed -i 's/\n//g; s/ /\\ /g; s/(/\\(/; s/)/\\)/' ~/.fzf_tmp + sed -i 's/\n//g; s/ /\\ /g; s/(/\\(/; s/)/\\)/' /tmp/fzf_tmp # If the program is on the GUI list add a '&' to the command history if [[ $1 =~ ^(zathura|vlc|eog|kolourpaint)$ ]]; then - sed -i '${s/$/ \&/}' ~/.fzf_tmp + sed -i '${s/$/ \&/}' /tmp/fzf_tmp fi # Grab the sanitised arguments - arguments=$(cat ~/.fzf_tmp) + arguments=$(cat /tmp/fzf_tmp) # Add the command with the sanitised arguments to our .bash_history echo ${1} ${arguments} >> ~/.bash_history @@ -192,8 +192,8 @@ f() { history -r # Clean up temporary variables - rm ~/.fzf_tmp -} + rm /tmp/fzf_tmp +} ``` ```sh