Home > Back-end >  Can't pass parameters to bash script from zsh
Can't pass parameters to bash script from zsh

Time:06-02

My bash script

#!/bin/bash

 main(){
  name=${1:-you}
  echo "One for $name, one for me."
}

 main "@a"

I'm trying to pass the parameters from zsh terminal like this

bash tw_fer.sh Adem

It always returns @a nothing else. How can I print the argument that I've passed?

CodePudding user response:

Replace "@a" by "$1" for only first parameter or "${@}" for all parameters

  • Related