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

Line break behavior is different from xargs #52

Closed
robario opened this issue May 12, 2017 · 4 comments
Closed

Line break behavior is different from xargs #52

robario opened this issue May 12, 2017 · 4 comments

Comments

@robario
Copy link

robario commented May 12, 2017

$ echo -ne "1\n\n2\n\n" | xargs printf '[%s]'
[1][2]
$ echo -ne "1\n\n2\n\n" | xpanes printf '[%s]'

# will open 4 panes, expected 2 panes
@greymd
Copy link
Owner

greymd commented May 12, 2017

It is not difficult to fix this issue soon, but it will most likely be resolved with another issue (#24) at the same time.
As the design direction of tmux-xpanes, I will try to implement the tokenization logic same as xargs as possible (It might be version 2.1.0).

Stay tuned :)

(Or, welcome any pull requests.)

@greymd
Copy link
Owner

greymd commented May 13, 2017

memo
It seems that xargs skips some characters in IFS.

$ echo -n "$IFS" | od -tx1c
0000000  20  09  0a  00
             \t  \n  \0
0000004

Not only line breaks, but also space and tab.

$ echo -ne "aa\n\n\t  \t\n\nbb" | xargs printf "[%s]"
[aa][bb]

NUL character causes warning message.

$ echo -ne "aa\n\n\t  \t\0\n\nbb" | xargs printf "[%s]"
xargs: WARNING: a NUL character occurred in the input.  It cannot be passed through in the argument list.  Did you mean to use the --null option?
[aa][][bb]% 

$ echo $?
0

@greymd
Copy link
Owner

greymd commented May 18, 2017

Fixed with v2.1.0.

$ echo -ne "1\n\n2\n\n" | xargs printf '[%s]'

Now will generate

root@e08434b0b7ba:/# printf [%s] 1             |root@e08434b0b7ba:/# printf [%s] 2                   
[1]root@e08434b0b7ba:/#                        |[2]root@e08434b0b7ba:/#                              
                                               |                                                     
                                               |                                                     
                                               |                                                     
                                               |                                                     
                                               |                                                     
                                               |                                                     
                                               |                                                     
                                               |                                                     
                                               |                                                     
                                               |                                                     
                                               |                                                     
                                               |                                                     
                                               |                                                     

@robario plz check it out.

@greymd greymd closed this as completed May 18, 2017
@robario
Copy link
Author

robario commented May 18, 2017

👍 perfect! @greymd

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

No branches or pull requests

2 participants