I think you forgot to attach the script. Anyway the problem seems to be that a "%R" formatting token is passed to date and it doesn't know how to handle it.
I think you forgot to attach the script. Anyway the problem seems to be that a "%R" formatting token is passed to date and it doesn't know how to handle it.
Sorry, now I have attached the script. man:date tells me that %R is recognized as a valid input for the format and date +%R gives me meaningful output.
Try this way:
date "$(./datefmt "foo\nymd hm")"
Now it works. Thanks. What exactly was the problem?
The argument was treated as two arguments instead of one.
Why? I have added quotes in my script, as you see. And if I try out just ./datefmt I do get the quotes in the output. If I manually input the output of datefmt into date I get the desired behaviour. Why is it that if I pass it directly using $() I get unexpeted behaviour?
I have no idea.
I guess the quotes were treated as part of the argument and not as a "whitespace escaper" (sorry, can't find a better name for it at this hour). This may have something to do with how the $() construction works. I have never seen it before, so I can't say.I have added quotes in my script, as you see.
Treat it as you would have passed:Why is it that if I pass it directly using $() I get unexpeted behaviour?
./datefmt.py +\"foo%n%F %R\" (quotes get escaped)
Bookmarks