Skip to content
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

z "" should act as z with no arguments (go to home directory) #799

Closed
nikitarevenco opened this issue Apr 23, 2024 · 3 comments
Closed

z "" should act as z with no arguments (go to home directory) #799

nikitarevenco opened this issue Apr 23, 2024 · 3 comments

Comments

@nikitarevenco
Copy link

nikitarevenco commented Apr 23, 2024

When we pass in an empty string it should treat it as if there are no arguments. I have this issue since I have a custom alias that is like this:

function s() { 
  z "$1" 
  ls
}

(I call it s because if I called it z it would lead to stack overflow)

So it works as expected - changing directory will show me what is inside of that directory. However it won't work when we input an empty string, as it will receive z "" which doesn't work

It would be nicer if z "" would by default change to home directory. And I have to resort to this for now:

function s() {
  z $1 # Does not follow best practices
  e
}
@ajeetdsouza
Copy link
Owner

Have you tried z "@"?

@nikitarevenco
Copy link
Author

Have you tried z "@"?

It says there is no match found. However, I was able to make it simpler with:

function s() { 
  z $1
  ls
}

(still doesn't change the original idea though)

@ajeetdsouza
Copy link
Owner

My bad, I missed the $ sign. This function will work for you:

function z() {
  z "$@"
  ls
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants