If you want to shift the positional parameters to the left, which command would you use?

  • shift
  • mv
  • leftshift
  • change
The correct answer is a) shift. The 'shift' command is used in shell scripts to shift the positional parameters to the left. When you use 'shift' without an argument, it discards the value of $1 and shifts the rest of the positional parameters, updating $1 to the previous $2, $2 to the previous $3, and so on. This is useful when processing command-line arguments.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *