Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.mac.system > #133897

Re: Wildcard and ls

From Lewis <g.kreme@gmail.com.dontsendmecopies>
Newsgroups comp.sys.mac.system
Subject Re: Wildcard and ls
Date 2020-07-30 11:49 +0000
Organization Miskatonic U
Message-ID <slrnri5cuu.15l0.g.kreme@ProMini.lan> (permalink)
References <4K5UG.88504$GQ4.53903@fx02.iad> <5f211067$0$522$65785112@news.neostrada.pl> <tm9UG.96980$r25.75717@fx08.iad> <5f2262be$0$538$65785112@news.neostrada.pl> <chine.bleu-69230D.03500830072020@reader.eternal-september.org>

Show all headers | View raw


In message <chine.bleu-69230D.03500830072020@reader.eternal-september.org> Siri Cruise <chine.bleu@yahoo.com> wrote:
> In article <5f2262be$0$538$65785112@news.neostrada.pl>,
>  Krzysztof Mitko <invalid@kmitko.at.list.dot.pl> wrote:

>> >> And that's the problem. Your shell is trying to expand the * wildcard
>> >> before sudo is executed and fails because lack of permissions.
>> > 
>> > 
>> > Thanks. That explains the behaviour. I had though that ls did its own
>> > wildcarding but in this case, I guess it is sudo that triggers the
>> > expansion.
>> > 
>> 
>> Bash triggers the expansion, not sudo. If I recall it goes like this:

> I can't try on other than macosx, but here sudo has a -s option 
> to have sudo parse the command.

> # ls r/*
> ls: r/*: Permission denied
> # sudo ls r/*
> ls: r/*: No such file or directory
> # sudo -s 'ls r/*'
> r/a r/b
> # sudo -s ls r/* 
> r/a r/b

Yes, the -s flag tells sudo "open a shell to run the commands" and in
fact, `sudo -s` by itself will spawn a root permissioned interactive
shell.

 -s, --shell
	  Run the shell specified by the SHELL environment variable if it
      is set or the shell specified by the invoking user's password 
      database entry.  If a command is specified, it is passed to 
      the shell for execution via the shell's -c option.  If no 
      command is specified, an interactive shell is executed.  Note 
      that most shells behave differently when a command is specified
      as compared to an interactive session; consult the shell's 
      manual for details.

(again, nothing to do with macOS specifically)

-- 
WORDS IN THE HEART CANNOT BE TAKEN --Feet of Clay

Back to comp.sys.mac.system | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Wildcard and ls JF Mezei <jfmezei.spamnot@vaxination.ca> - 2020-07-28 23:07 -0400
  Re: Wildcard and ls Arlen Holder <arlenholder@newmachine.com> - 2020-07-29 05:06 +0000
    Re: Wildcard and ls nospam <nospam@nospam.invalid> - 2020-07-29 01:35 -0400
      Re: Wildcard and ls Arlen Holder <arlenholder@newmachine.com> - 2020-07-29 12:41 +0000
    Re: Wildcard and ls Krzysztof Mitko <invalid@kmitko.at.list.dot.pl> - 2020-07-29 08:04 +0200
      Re: Wildcard and ls Arlen Holder <arlenholder@newmachine.com> - 2020-07-29 12:40 +0000
        Re: Wildcard and ls Arlen Holder <arlenholder@newmachine.com> - 2020-07-29 14:21 +0000
  Re: Wildcard and ls Krzysztof Mitko <invalid@kmitko.at.list.dot.pl> - 2020-07-29 08:00 +0200
    Re: Wildcard and ls JF Mezei <jfmezei.spamnot@vaxination.ca> - 2020-07-29 03:15 -0400
      Re: Wildcard and ls Lewis <g.kreme@gmail.com.dontsendmecopies> - 2020-07-29 09:49 +0000
        Re: Wildcard and ls Jolly Roger <jollyroger@pobox.com> - 2020-07-29 18:45 +0000
          Re: Wildcard and ls Arlen Holder <arlenholder@newmachine.com> - 2020-07-30 02:39 +0000
      Re: Wildcard and ls Krzysztof Mitko <invalid@kmitko.at.list.dot.pl> - 2020-07-30 08:03 +0200
        Re: Wildcard and ls Siri Cruise <chine.bleu@yahoo.com> - 2020-07-30 03:50 -0700
          Re: Wildcard and ls Krzysztof Mitko <invalid@kmitko.at.list.dot.pl> - 2020-07-30 13:40 +0200
          Re: Wildcard and ls Lewis <g.kreme@gmail.com.dontsendmecopies> - 2020-07-30 11:49 +0000
        Re: Wildcard and ls Lewis <g.kreme@gmail.com.dontsendmecopies> - 2020-07-30 11:43 +0000
        Re: Wildcard and ls Barry Margolin <barmar@alum.mit.edu> - 2020-07-30 10:26 -0400
          Re: Wildcard and ls Lewis <g.kreme@gmail.com.dontsendmecopies> - 2020-07-30 14:55 +0000
      Re: Wildcard and ls Krzysztof Mitko <invalid@kmitko.at.list.dot.pl> - 2020-07-30 08:23 +0200

csiph-web