openmic.social is an uncensored community. You may encounter strong language, controversial opinions, and mature or NSFW material. You must be 18+ to browse. Illegal content is prohibited and removed on sight — please report it. By continuing, you accept that you may see content you personally disagree with.
You may want to learn about the shell’s “history expantion” functions. as an example:
~$ ls ~/Documents/taxes/tax_year_2012/2012-12-01.txt
/home/tom/Documents/taxes/tax_year_2012/2012-12-01.txt
~$ cd !!$:h
cd ~/Documents/taxes/tax_year_2012
~/Documents/tax_2012$ pwd
/home/tom/Documents/taxes/tax_year_2012
Here the string “!!$:h” is basically the last command’s [ !! ] last argument [$], stripped of its last path component [:h].
You may want to learn about the shell’s “history expantion” functions. as an example:
~$ ls ~/Documents/taxes/tax_year_2012/2012-12-01.txt /home/tom/Documents/taxes/tax_year_2012/2012-12-01.txt ~$ cd !!$:h cd ~/Documents/taxes/tax_year_2012 ~/Documents/tax_2012$ pwd /home/tom/Documents/taxes/tax_year_2012Here the string “
!!$:h” is basically the last command’s [!!] last argument [$], stripped of its last path component [:h].