Shell scripts
Tip1:
- 1st command:
# chown example:example
/var/www/vhost/default-domain.com/httpdocs/example.html - 2nd command:
#^example.html^other.html - The second command will substitute example.html with other.html and the result is:
# chown example:example /var/www/vhost/default-domain.com/httpdocs/other.html
This is nice for long command especially when bash is not available.
Tip2:
- 1st command
# ls /var/www/vhost/default-domain.com/httpdocs/example.html - 2nd command
# cat !^ - This time the second command it is executing cat with the argument of the last command and the result will be:
# cat /var/www/vhost/default-domain.com/httpdocs/example.html - In a similar way:
!:2, !:3... are the second, third(and so on) arguments of the last command
!-2, !-3, … are earlier commands
!-2^, !-2:2, !-2$ will be the first, second and last argument of the pre-previouous command. - And now the question: What is " !-2:0 -R !^ !-3:2 " ? :)