Skip to main content

All Questions

0 votes
0 answers
244 views

How does history print to the terminal?

EDIT: As per @JdeBP's comment, I've learned that the history command and the history recall functionality of interactive terminals are two separate things. I am, however, still curious about how the ...
ExecutionByFork's user avatar
1 vote
1 answer
424 views

Using interactive's shell history expansion inside a script

I have the following Bash script set -o histexpand set -o history pwd lc="!!" which, when I run it in an interactive shell, prints /home/user lc="pwd" I'd like to, instead of getting lc=pwd, get ...
History_expansion's user avatar
4 votes
1 answer
772 views

History expansion in scripts [duplicate]

I have the following Bash script case $- in (*H*) echo enabled ;; (*) echo disabled ;; esac set -H case $- in (*H*) echo enabled ;; (*) echo disabled ;; esac pwd last_command="!!" echo $last_command ...
History_expansion's user avatar
3 votes
2 answers
936 views

Sync two folders and on success copy one file from a location to the other

I am using rsync command to sync two folder and on success of rysnc I want to copy a file success and while copying append source folder name parameter like Success_FolderName.I am using $(basename !:...
HDev007's user avatar
  • 261
-1 votes
1 answer
879 views

History substitution fails when implemented in shell script [duplicate]

The below command works in command line rsync -avh -r /Source/09_03_2016/ /Destination/ echo $(basename !:3) Output 09_03_2016 But when I do this in shell script it does not work #! /bin/bash /...
HDev007's user avatar
  • 261
0 votes
1 answer
194 views

Persistent Bash history between detached processes

I haven't yet been able to find this among the Bash documentation so I was hoping it could get answered if I asked it here. Is there any way that I can, on execution of a script, branch its history (...
Francesco Gramano's user avatar
2 votes
2 answers
564 views

Livesearch with first 10 matches as preview for zsh-history?

I have seen a history-livesearch with a preview, that shows the 10 first matches in the history in a list below the BUFFER-line, which is updated on every keystroke, and acts like the standard ctrl+r ...
HopefullyHelpful's user avatar