From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 45C09158042 for ; Wed, 30 Oct 2024 17:25:57 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E9387E07D0; Wed, 30 Oct 2024 17:25:49 +0000 (UTC) Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A2A37E07A5 for ; Wed, 30 Oct 2024 17:25:49 +0000 (UTC) Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-6e5e5c43497so57248687b3.3 for ; Wed, 30 Oct 2024 10:25:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730309149; x=1730913949; darn=lists.gentoo.org; h=content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:to:subject:from:to:cc:subject :date:message-id:reply-to; bh=GvCcHGfVXSCm+RGGZqXRfk3WxkcLYNi5moNjw3Niqro=; b=k9S0ANa/uCq5BnqAjIdJ7+ZN1h349LMC4nCtp2RvjwRMHIlXnqOxv4maaaJnN0WSpN nCBKnGALp9Hzst30KYLDvwJpBEYGi4/p39lXDTjRvACNIOIIDuNPWj2WYRgpbFjSxvFz qeqepRK9c3gLIsZTxOuUAKhbl0FQl4S502hTnAQmaN4zhHno9T1ph41J1UDCGeO+ScbW 8JG9K6dJU3neE58hl0HVBY5FIF9FblD/mnB+bxLu7ReP8TM57ZUOJ99Uos+bpKwM+RiA 2sz2imortIRTCsVSj5yVf2kreYyZKAQFKAanYqKBIIncBOjAIyg6B8P/Nv61npMV8VRU +wJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730309149; x=1730913949; h=content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:to:subject:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=GvCcHGfVXSCm+RGGZqXRfk3WxkcLYNi5moNjw3Niqro=; b=sjFKVpItrypEGxsT7fTIDYI90mUC/xpFQashf5yPOuY6jTEYb2JXqO3tAZyO6BpiYZ f8XGk/WyXgj/mV+KU96KHhkeWFkEwBCXVAPEIBBg/G9es4BKP6NETQKCmUw+v7cS09jY cUClcRaJVa6aEmaoyVn91utbr/3Ku+WQrngHjDLYsPAA5BUub5pNh2y7x9WPK4k2dLea 5GdJEjDi+e31vGIHo0Dt87X1wLWh61ANe5PvwepDFHkd1igtzTbf7FE9Guc5bdsTVTUx nq4oeO4hKMAf0OZiegvT/IHhdu9gZ1enWNaEn1yIuSKhxDO0GBvqguMoVnYRoWTbv5Mr OVSQ== X-Gm-Message-State: AOJu0YzXaiXBqU939t/MHT7MoFf/uTENd7UEobJGV4ybRur0NB048gQc 64zkGr4jlIwa3P0fTQFBMDPWxZnVJNBCooXjiow8IrNtLEvDGx9b X-Google-Smtp-Source: AGHT+IE6/Sg95vEVNigQHU9QUdgAudmqDBnWRezGRxege1F7m3p6SJMfD/DiDSWAgqIHYahG1qAZRA== X-Received: by 2002:a05:690c:6711:b0:6dd:e837:3596 with SMTP id 00721157ae682-6ea52360e93mr3961597b3.14.1730309148664; Wed, 30 Oct 2024 10:25:48 -0700 (PDT) Received: from [10.8.8.6] ([92.119.19.67]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6e9c6c77a5dsm25338097b3.96.2024.10.30.10.25.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 30 Oct 2024 10:25:48 -0700 (PDT) Subject: Re: [gentoo-user] Renaming files with those pesky picture type characters. To: gentoo-user@lists.gentoo.org References: <32f571c7-de3f-53da-185a-9cdfa0797a93@gmail.com> <4973073.31r3eYUQgx@rogueboard> <2d8f86e2-923a-cc81-e56d-63135b379737@gmail.com> <2973073.e9J7NaK4W3@rogueboard> <0c892dd0-a1d1-4372-ad62-a64cd751e270@gmail.com> <76de2cf9-c045-45c3-b4ed-9c549beadfa1@gentoo.org> From: Dale Autocrypt: addr=rdalek1967@gmail.com; prefer-encrypt=mutual; keydata= mQINBGFSciYBEADcEGMyJBSuavKO/XKUVvgkxck7Nl8Iuu8N2lcnRji/rSKg5c1Acix1ll9i oW8JBCHwvn0+Xy60BvEsqcup3YSHw5STl/bR1ePEehtnYrg8FdjdS91+B805RfnKMm69rFVI wLSBHQrSG1yxHd8CloWoEdhmVtP24buajbh114bgXd9ahtpZrCVMrWdWYUg2mEXguGV5uNAh Rf8SWxDNc79w24JxsV34a8niMUYMjzWr0rafIbzk732X38vGjVMLo/2mMpkbp9mPp++LHoY+ 0Pet8zxxdXPJSCd475kza1AD+hhSyBZXB9yknYWgyY3cZe1rGmooJSi2KX4QxO7npwLThcO1 be6KKRkd35+Fi/a1BzVOHsZMiK/gcwxEFoMd27gir4ehaeHJfFXl+65w4hj0EsOZSxrJrm2C R50g5By2czSKP1bADEygFNpIJj51AR+wM88NImG2RPtlT2maYBzazvF05g65cdHXGp1C7W5P wwwKU2DgABB2t7N7z5A69LnryBRw4zUYDRRYLTYlBlYgg+xILm2c0OrBdxJgLJa7JE50Eo25 d3PFwt9J0gYvqy6sPFLl9So0sDg9zm0hKQtXOP5kgropUFGrNoJI+mjwF4rYLRBVzZwNAvlO OhEvHubBo3mEllv4x+FeptwXZxlk7gUsdqI8AxnFB8K9wi6FVQARAQABtBtEYWxlIDxyZGFs ZWsxOTY3QGdtYWlsLmNvbT6JAk4EEwEIADgCGyMFCwkIBwIGFQoJCAsCBBYCAw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Fc5k3GU1AVpTCMs3ayYCzo0b2pvEvdjtDcA CYLEFPWgaFX9iQAM/CDfKvTtvgGWpqtCL2raq/mQoJEU Message-ID: Date: Wed, 30 Oct 2024 12:25:46 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.19 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 In-Reply-To: <76de2cf9-c045-45c3-b4ed-9c549beadfa1@gentoo.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 93863f5c-5d63-4904-8028-392ba6dd27c1 X-Archives-Hash: bb34d47a21da6fb713da44e2a1c8d71a Eli Schwartz wrote: > On 10/29/24 2:05 PM, Dale wrote: >> I saw that but never understood what it did. I thought it was >> something that worked just with revdep-rebuild or something. So it >> is a bash thing. Interesting. That could open a can of worms. > It's not a bash thing. It is a software thing. It is mandated by the > POSIX standard: > > https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html > > That means, as a general rule of thumb, all Unix commands required to > exist everywhere, *have to* support the usage of "--" in this manner. > And since it is a sensible thing to do, most programs, even not POSIX > programs, heed the wise advice of POSIX and support "--". > Oh, that's good.  I think.  :/  That link has a lot of info.  That could take a while to digest.  I did find the -- part tho.  > On 10/29/24 11:18 AM, Dale wrote: >> Howdy, >> >> I downloaded some files. I have a few that have some weird names. >> Some have those picture type characters. Some start with a dash, >> "-". In some cases I can use wild cards to change them. Frank gave >> me some ideas on that off list, while discussing his nifty checksum >> tool. Anyway, I ran up on a few that start with a dash, "-", and I >> can't find a way around that. The mv command thinks it is me trying >> to include a option. It spits out something like this. >> >> >> mv: unrecognized option '---ne.avi' >> >> >> Some of the other characters I run into look like this. >> >> >> ���� >> >> >> Those I can usually get around with wildcards. I have not found a >> way to get around the ones with the dash in front tho. I tried a >> single quote, double quote etc but still no worky. Also, tab >> completion doesn't help either. > > I feel like, in combination with the bash comment above, this speaks to > a general misunderstanding of how quotes, dashes, wildcards, etc work. > > > So I would like to clarify something here. If you try to > > $ mv ---ne.avi new-filename.avi > > and it doesn't work, and you try > > $ mv "---ne.avi" new-filename.avi > > > Or more generally, if you have a filename named > > this is a weird filename.avi > > > You have various options for writing a "mv" command for it in a bash > shell, but that's not actually what the "mv" program sees. > > Example: > > > $ mv "this is a weird filename.avi" better.avi > > is actually executed as an operating system array: > > {"mv", "this is a weird filename.avi", "better.avi"} > > > You can also do: > > $ mv this\ is\ a\ weird\ filename.avi better.avi > > Still, bash tries to figure out how to convert it into an operating > system array, and gets: > > {"mv", "this is a weird filename.avi", "better.avi"} > > You can even do: > > $ mv *weird*filename.avi" better.avi > > Still, bash tries to figure out how to convert it into an operating > system array, and gets: > > {"mv", "this is a weird filename.avi", "better.avi"} > > It's always converted to that array. But, > > $ mv this is a weird filename.avi better.avi > > becomes this array: > > {"mv", "this", "is", "a", "weird", "filename.avi", "better.avi"} > > and obviously that is an entirely different command because the array is > different (each part is a different filename, as far as "mv" knows.) > > > Same with stuff that begins with a dash. > > $ mv "---ne.avi" new-filename.avi > $ mv '---ne.avi' new-filename.avi > $ mv ---ne.avi new-filename.avi > $ mv *-ne.avi new-filename.avi > $ mv \-\-\-ne.avi new-filename.avi > > > all become > > {"mv", "---ne.avi", "new-filename.avi"} > > > Which does not help you because the array values that the "mv" command > sees are still starting with a single dash. > > > From bash (and from bash tab completion) all you can do is update bash > text lines which then get translated into arrays so you can execute the > array as a program. Quoting and wildcards do NOT affect how "mv" works. > All that quoting and wildcards do is affect whether space characters are > interpreted as part of the filename or as the separator between > different array items. > > The "mv" program is responsible for knowing what a dash is or does. It > tries first to treat it as an option, and that's why "--" works -- > because it tells "mv" itself to stop treating it as an option, and to > treat it as a filename instead. > > That is also why "./---new.avi" works. All filenames (except those > starting with / such as /home or /usr, of course) can have an added > directory at the beginning, and the obvious one is ./ but you could also > use "$PWD/---new.avi" if you wanted. Since it doesn't start with a dash, > it can't be an option. > Well, I did try single quotes, double quotes and other stuff I'd seen before but none worked.  Eventually, I ran out of ideas.  I've never ran into anything that required more than that either.  So, I brought up my search engine and then it hit me, what do I search for????  I went outside, watered my kale and collard green seeds, and did some thinking.  I couldn't even think of what to search for to find a answer.  Given it didn't work in a GUI or command line, I was kinda lost.  I did know tho, there was a way.  There had to be.  I decided to just ask.  Now I have lots more info in case I run up on this again.  I also added a entry to my tips cheat sheet.  Oh, I can also run Frank's checksum tool on that directory.  I store that data for someone else.  It should ever change.  That's the reason for the checksum tool for it.  Thanks much.  Dale :-)  :-)  P. S.  My mustard and turnip greens are popping up.  That will make family, friends and neighbors happy.  I had to reseed my collard and kale.  May have put first planting to deep.