dirname appears not to work with xargsman xargs says standard input is delimited by blanks; but is it?using...
Is there any differences between “gucken” and “schauen”?
Is residual finiteness a quasi isometry invariant for f.g. groups?
How does 子 come to mean 'midnight'?
What is this metal M-shaped device for?
Overfitting and Underfitting
Would a National Army of mercenaries be a feasible idea?
Citing paywalled articles accessed via illegal web sharing
Placing an adverb between a verb and an object?
Using only 1s, make 29 with the minimum number of digits
Chess tournament winning streaks
It took me a lot of time to make this, pls like. (YouTube Comments #1)
Notes in a lick that don't fit in the scale associated with the chord
Why is working on the same position for more than 15 years not a red flag?
Can I write a book of my D&D game?
Word or phrase for showing great skill at something without formal training in it
Could flying insects re-enter the Earth's atmosphere from space without burning up?
Why do members of Congress in committee hearings ask witnesses the same question multiple times?
How to acknowledge an embarrassing job interview, now that I work directly with the interviewer?
Is a debit card dangerous for an account with low balance and no overdraft protection?
Avoiding morning and evening handshakes
Do authors have to be politically correct in article-writing?
Program that converts a number to a letter of the alphabet
Checking for the existence of multiple directories
What does Cypher mean when he says Neo is "gonna pop"?
dirname appears not to work with xargs
man xargs says standard input is delimited by blanks; but is it?using xargs to grep multiple patternsLinux: Does find | xargs grep have limitations?Understanding -regex with GNU findechoing basename under xargs?Find files recursively that are older than one year and not owned by a specific userHow to use `yes` with `xargs -p`?Chaining grep commandsHow do I get xargs to show me the command lines it's generating without running them?xargs interface for tar balls
xargs
and basename
work together as I would expect:
$ printf '%sn' foo/index.js bar/index.js baz/index.js | xargs basename
index.js
index.js
index.js
xargs
and dirname
, though, appear not to work together:
$ printf '%sn' foo/index.js bar/index.js baz/index.js | xargs dirname
usage: dirname path
I would expect
foo
bar
baz
as output. What am I missing?
I'm on Darwin 18.2.0 (macOS 10.14.3).
osx xargs dirname
New contributor
add a comment |
xargs
and basename
work together as I would expect:
$ printf '%sn' foo/index.js bar/index.js baz/index.js | xargs basename
index.js
index.js
index.js
xargs
and dirname
, though, appear not to work together:
$ printf '%sn' foo/index.js bar/index.js baz/index.js | xargs dirname
usage: dirname path
I would expect
foo
bar
baz
as output. What am I missing?
I'm on Darwin 18.2.0 (macOS 10.14.3).
osx xargs dirname
New contributor
add a comment |
xargs
and basename
work together as I would expect:
$ printf '%sn' foo/index.js bar/index.js baz/index.js | xargs basename
index.js
index.js
index.js
xargs
and dirname
, though, appear not to work together:
$ printf '%sn' foo/index.js bar/index.js baz/index.js | xargs dirname
usage: dirname path
I would expect
foo
bar
baz
as output. What am I missing?
I'm on Darwin 18.2.0 (macOS 10.14.3).
osx xargs dirname
New contributor
xargs
and basename
work together as I would expect:
$ printf '%sn' foo/index.js bar/index.js baz/index.js | xargs basename
index.js
index.js
index.js
xargs
and dirname
, though, appear not to work together:
$ printf '%sn' foo/index.js bar/index.js baz/index.js | xargs dirname
usage: dirname path
I would expect
foo
bar
baz
as output. What am I missing?
I'm on Darwin 18.2.0 (macOS 10.14.3).
osx xargs dirname
osx xargs dirname
New contributor
New contributor
edited 1 hour ago
Jeff Schaller
42.8k1159136
42.8k1159136
New contributor
asked 3 hours ago
davidchambersdavidchambers
1084
1084
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
dirname
on macOS only takes a single pathname, whereas basename
is able to work with multiple pathnames. It is however safest to call basename
with a single pathname so that it does not accidentally try to remove the the second pathname from the end of the first, as in
$ basename some/file e
fil
When calling these utilities from xargs
you may ask xargs
to run the utility with a single newline-delimited string at a time:
printf '%sn' some arguments | xargs -I {} basename {}
or,
printf '%sn' some arguments | xargs -I {} dirname {}
You could also use xargs -L 1 utility
rather than xargs -I {} utility {}
.
1
I fundamentally misunderstoodxargs
. I was under the impression that its default behaviour was to execute the utility once for each input line. Thanks for correcting my understanding.
– davidchambers
15 mins ago
add a comment |
dirname
only takes 1 argument; while the GNU/coreutils version of dirname
can take more than 1 argument, that is a non-standard extension:
SYNOPSIS
dirname string
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
davidchambers is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f503944%2fdirname-appears-not-to-work-with-xargs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
dirname
on macOS only takes a single pathname, whereas basename
is able to work with multiple pathnames. It is however safest to call basename
with a single pathname so that it does not accidentally try to remove the the second pathname from the end of the first, as in
$ basename some/file e
fil
When calling these utilities from xargs
you may ask xargs
to run the utility with a single newline-delimited string at a time:
printf '%sn' some arguments | xargs -I {} basename {}
or,
printf '%sn' some arguments | xargs -I {} dirname {}
You could also use xargs -L 1 utility
rather than xargs -I {} utility {}
.
1
I fundamentally misunderstoodxargs
. I was under the impression that its default behaviour was to execute the utility once for each input line. Thanks for correcting my understanding.
– davidchambers
15 mins ago
add a comment |
dirname
on macOS only takes a single pathname, whereas basename
is able to work with multiple pathnames. It is however safest to call basename
with a single pathname so that it does not accidentally try to remove the the second pathname from the end of the first, as in
$ basename some/file e
fil
When calling these utilities from xargs
you may ask xargs
to run the utility with a single newline-delimited string at a time:
printf '%sn' some arguments | xargs -I {} basename {}
or,
printf '%sn' some arguments | xargs -I {} dirname {}
You could also use xargs -L 1 utility
rather than xargs -I {} utility {}
.
1
I fundamentally misunderstoodxargs
. I was under the impression that its default behaviour was to execute the utility once for each input line. Thanks for correcting my understanding.
– davidchambers
15 mins ago
add a comment |
dirname
on macOS only takes a single pathname, whereas basename
is able to work with multiple pathnames. It is however safest to call basename
with a single pathname so that it does not accidentally try to remove the the second pathname from the end of the first, as in
$ basename some/file e
fil
When calling these utilities from xargs
you may ask xargs
to run the utility with a single newline-delimited string at a time:
printf '%sn' some arguments | xargs -I {} basename {}
or,
printf '%sn' some arguments | xargs -I {} dirname {}
You could also use xargs -L 1 utility
rather than xargs -I {} utility {}
.
dirname
on macOS only takes a single pathname, whereas basename
is able to work with multiple pathnames. It is however safest to call basename
with a single pathname so that it does not accidentally try to remove the the second pathname from the end of the first, as in
$ basename some/file e
fil
When calling these utilities from xargs
you may ask xargs
to run the utility with a single newline-delimited string at a time:
printf '%sn' some arguments | xargs -I {} basename {}
or,
printf '%sn' some arguments | xargs -I {} dirname {}
You could also use xargs -L 1 utility
rather than xargs -I {} utility {}
.
answered 3 hours ago
KusalanandaKusalananda
133k17254417
133k17254417
1
I fundamentally misunderstoodxargs
. I was under the impression that its default behaviour was to execute the utility once for each input line. Thanks for correcting my understanding.
– davidchambers
15 mins ago
add a comment |
1
I fundamentally misunderstoodxargs
. I was under the impression that its default behaviour was to execute the utility once for each input line. Thanks for correcting my understanding.
– davidchambers
15 mins ago
1
1
I fundamentally misunderstood
xargs
. I was under the impression that its default behaviour was to execute the utility once for each input line. Thanks for correcting my understanding.– davidchambers
15 mins ago
I fundamentally misunderstood
xargs
. I was under the impression that its default behaviour was to execute the utility once for each input line. Thanks for correcting my understanding.– davidchambers
15 mins ago
add a comment |
dirname
only takes 1 argument; while the GNU/coreutils version of dirname
can take more than 1 argument, that is a non-standard extension:
SYNOPSIS
dirname string
add a comment |
dirname
only takes 1 argument; while the GNU/coreutils version of dirname
can take more than 1 argument, that is a non-standard extension:
SYNOPSIS
dirname string
add a comment |
dirname
only takes 1 argument; while the GNU/coreutils version of dirname
can take more than 1 argument, that is a non-standard extension:
SYNOPSIS
dirname string
dirname
only takes 1 argument; while the GNU/coreutils version of dirname
can take more than 1 argument, that is a non-standard extension:
SYNOPSIS
dirname string
answered 3 hours ago
Uncle BillyUncle Billy
6016
6016
add a comment |
add a comment |
davidchambers is a new contributor. Be nice, and check out our Code of Conduct.
davidchambers is a new contributor. Be nice, and check out our Code of Conduct.
davidchambers is a new contributor. Be nice, and check out our Code of Conduct.
davidchambers is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f503944%2fdirname-appears-not-to-work-with-xargs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown