Is it possible to create a Bash alias that upon running, enters a string of my prior choosing, into Terminal?
Let's pretend this is in my ~/.bash_profile
:
alias start_youtube="cd ~/Video/Youtube; **[PASTE: youtube-dl URL]**"
Imagine that: the alias would change directory to Video/Youtube
and then [PASTE] the string: youtube-dl URL
. It could either do Return ⏎ or preferably just leave the string youtube-dl URL
in the Terminal prompt so that I could swap the placeholder URL for a real URL.
If I try actually running the alias below;
alias start_youtube="cd ~/Video/Youtube; youtube-dl URL"
it will run the command as entered by which youtube-dl will return an error like "Could not parse URL" – which could've been fine. But pressing the ↑ key will not show the last input of the alias (youtube-dl URL
) but rather shows the invoking of the alias (start_youtube
) [which I'm sure is usually preferable].
So the requested solution is to paste a placeholder string into the Command Prompt, or somehow access the history of the alias command via the Shell.