Skip to content

By using zsh one would get the following error: #5410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

grussdorian
Copy link

When using zsh the following error occurred:

dirname: missing operand
Try 'dirname --help' for more information.
basename: missing operand
Try 'basename --help' for more information

The error occurs because the script uses Bash-specific syntax ($BASH_SOURCE) which is not available in zsh

export PIC_PROFILE=$(cd $(dirname ${BASH_SOURCE:-$0}) && pwd)/$(basename ${BASH_SOURCE:-$0})

$0 in Zsh contains the path to the current script, similar to $BASH_SOURCE in Bash.
dirname $0 extracts the directory path of the script.
basename $0 extracts the script's filename.
$(cd $(dirname $0) && pwd) changes to the script's directory and outputs the full path, ensuring it's absolute.

This checks for $BASH_SOURCE (for Bash) and falls back to $0 (for Zsh)

dirname: missing operand
Try 'dirname --help' for more information.
basename: missing operand
Try 'basename --help' for more information

The error occurs because the script uses Bash-specific syntax ($BASH_SOURCE) which is not available in zsh

```
export PIC_PROFILE=$(cd $(dirname ${BASH_SOURCE:-$0}) && pwd)/$(basename ${BASH_SOURCE:-$0})
```

This checks for $BASH_SOURCE (for Bash) and falls back to $0 (for Zsh)
@ikbuibui ikbuibui added the CI:no-compile CI is skipping compile/runtime tests but runs PICMI tests label Jul 14, 2025
@ikbuibui
Copy link
Contributor

Thanks for the PR. I know in our group atleast @chillenzer is using zsh and has his own versions of these files.
@chillenzer @psychocoderHPC What is your opinion on support other shells?
If we accept this PR to support alternative shells, this change must also be made in all the many other profiles we have. Another option is to add documentation for known modifications required for particular system setups and not actually change the source, but this is also on best effort basis, based on what software is being used by this community.

@ikbuibui ikbuibui requested a review from chillenzer July 16, 2025 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI:no-compile CI is skipping compile/runtime tests but runs PICMI tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants