0

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?

1
  • There is no zsh involved in your code. You just pass to main the string @a, and this is output in the echo statement. What effect would you have expected? Commented Jun 2, 2022 at 6:04

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.