return code of previous command bash code example
Example 1: bash use argument from previous command
!^ first argument
!$ last argument
!* all arguments
!:2 second argument
!:2-3 second to third arguments
!:2-$ second to last arguments
!:2* second to last arguments
!:2- second to next to last arguments
!:0 the command
!! repeat the previous line
Example 2: store result of command in variable bash
variable=$(command [option…] argument1 arguments2 …)