Gentoo Archives: gentoo-user

From: Frank Steinmetzger <Warp_7@×××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Dolphin and adding a option, if it exists.
Date: Tue, 22 Nov 2022 10:07:19
Message-Id: Y3yfSaXVo0pYUStB@tp
In Reply to: Re: [gentoo-user] Dolphin and adding a option, if it exists. by Dale
1 Am Tue, Nov 22, 2022 at 03:59:27AM -0600 schrieb Dale:
2
3 > > If you still want to stick to a terminal solution akin to mv, then there is
4 > > no way around a little script which wraps mv by extracting the extension and
5 > > filename base. You could also add some “intelligence” with regards to
6 > > directories, in order to reduce the amount of effort required to use the
7 > > command—in case your directories follow some schema or are constant.
8 > >
9 > >
10 > > #!/usr/bin/sh
11 > >
12 > > [ "$#" -ne "2" ] && exit 1
13 > > SRC="$1"
14 > > DST="$2"
15 > >
16 > > SRC_EXT="${SRC##*.}"
17 > > DST_BASE="${DST%.*}"
18 > >
19 > > # remove destination for the case that the extensions differ
20 > > rm "$DST"
21 > >
22 > > mv "$SRC" "${DST_BASE}${SRC_EXT}"
23 > >
24 >
25 > I finally got a chance to try this.  I saved it and made it executable. 
26 > It runs but gave me this error. 
27 >
28 >
29 > dmv torrent/video_name-old-place.mp4 video-name-new-place.mp4
30 > bash: /bin/dmv: /usr/bin/sh: bad interpreter: No such file or directory
31 > dale@fireball ~/Desktop/Crypt/Series $
32 >
33 >
34 > My scripting skills are minimal at best.  Still, I kinda got what your
35 > script was doing.  Those who have known me for a while understand how
36 > miraculous that is.  ROFL  I did some googling.  It seems to not be able
37 > to find the 'shebang' part.  Sure enough, sh isn't located in /usr/bin
38 > here.  It's in /bin tho.  I edited that line so it can find it.  When I
39 > tried it, it worked but noticed another problem. […]
40
41 Well, it would have been boring to provide you with a turn-key solution. ;-)
42 Congrats on getting it working. In my Arch setup, sh is in /usr/bin. A
43 flexible solution is to use #!/usr/bin/env sh, which looks the command up
44 before executing it.
45
46 > I added a little . on that last line before the extension bit.  I'm a
47 > happy camper.
48
49 Give me a nudge if you want the more luxurious version with interactive
50 selection of the overwrite destination. I think I already started a
51 prototype somewhere, but can’t find it right now.
52
53 --
54 Grüße | Greetings | Salut | Qapla’
55 Please do not share anything from, with or about me on any social network.
56
57 The best thing about Sundays is Saturday evening.

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] Dolphin and adding a option, if it exists. Dale <rdalek1967@×××××.com>
Re: [gentoo-user] Dolphin and adding a option, if it exists. Wol <antlists@××××××××××××.uk>