Coder Social home page Coder Social logo

'*' does not work for me about hr HOT 8 CLOSED

svenXY avatar svenXY commented on May 28, 2024
'*' does not work for me

from hr.

Comments (8)

jomo avatar jomo commented on May 28, 2024

Your shell performs pattern matching on the asterisk, although it is quoted. Weird.
Which shell do you use?

from hr.

LuRsT avatar LuRsT commented on May 28, 2024

Hi @svenXY,

As @jomo said, it's probably your shell doing expansion before passing it to the script, you can test this easily to see it for yourself:

$ echo '*'

I bet you will get aaa bbb ccc ddd if your shell is indeed expanding it. I don't know which shell you are using, but you can try with double quotes to see if it doesn't expand anymore.

In bash and zsh, these are my results:

$ ls
aaa  bbb  ccc  ddd
$ echo "*"
*
$ echo '*'
*
$ echo *
aaa  bbb  ccc  ddd

I hope this helps!

from hr.

svenXY avatar svenXY commented on May 28, 2024

Yes, it does expand the asterisk although it is quoted:

> echo $SHELL
/usr/bin/zsh
> hr.sh '*'
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
ddddddddddddddddddddddddddddddddddddddddddddddddddd
> echo '*'
*
> bash
$ echo '*'
*
$ hr.sh '*'
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
dddddddddddddddddddddddddddddddddddddddddddddddddddd

See? Problem persists.

FWIW: I also tried the hr.py approach and it works fine.

from hr.

LuRsT avatar LuRsT commented on May 28, 2024

Hmmmm, that is very interesting, I can't reproduce that behaviour with my zsh, could you make sure that you have the latest version of hr?

Also, you can try these different scenarios:

  • Move ~/.zshrc to some other file to test with pure zsh (maybe your config has something special)
  • Run this command on your shell: /usr/bin/env bash this is the shebang and although I'm fairly sure you probably have bash and env, there may be something funny happening there.

Apart from this, I don't know what to try, I'm guessing that bash is expanding the value somewhere in the script, but the only way to know is by debugging, and unfortunately I cannot replicate it.

Please tell me if any of that worked.

from hr.

svenXY avatar svenXY commented on May 28, 2024

Nothing helped, whatever I did in zsh and bash, and in whatever terminal (urxvt, xfce4-terminal) and with some different TERM settings (xterm-256color, rxvt-unicode-256color), problem persists.

Since hr.py works fine for me, it is now purely academical, but maybe you are more concerned???

Thanks for your help anyway.

Sven

from hr.

LuRsT avatar LuRsT commented on May 28, 2024

Yeah, I'm still worried about it, since if it happened to you, it may happen to someone else in the future, hopefully we'll be able to figure out the problem.

Thanks for your contribution!

from hr.

svenXY avatar svenXY commented on May 28, 2024

Let me know how I can help you further and I'm glad to do so, but I'm out of ideas currently.

from hr.

leoj3n avatar leoj3n commented on May 28, 2024

Perhaps try noglob? noglob hr *

from hr.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.