![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Orchid Win7 v1 <voi### [at] dev null> wrote:
> It's truly terrifying just how much stuff you /can/ do with Bash.
Bah, it doesn't even compare to zsh.
For example zsh's file completion system can be quite awesome sometimes.
For example, suppose there are several files in the current directory,
all of them with +r rights for others, except for one. You start writing
"chmod o+r " and then press tab... and it completes to the only file for
which the command has a changing effect.
Or suppose that there are several files, only one of them is a .pdf, and
you write "acroread " and press tab... and it completes to that .pdf file
(even though there could be many other possibilities.)
Or you are deep inside a directory structure that's version-controlled by
git (the .git directory being far upward in the directory structure).
Among several files in the current directory, there's only one that's not
being tracked by git. You write "git add " and press tab... and you can
guess what happens.
Or you write "mplayer " and press tab, and it lists all possible
completions, including the different protocols that mplayer supports
(such as "cdda://", "dvd://", "http://", "tv://" and so on.)
Or you write "git commit -" and press tab... and it lists all possible
options that could follow.
Well, that's nothing still. You start writing "scp somehost:" and press
tab, zsh will ask for your ssh password for that host, and then will start
completing the remote files...
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Mon, 25 Feb 2013 14:59:22 -0500, Warp wrote:
> Well, that's nothing still. You start writing "scp somehost:" and press
> tab, zsh will ask for your ssh password for that host, and then will
> start completing the remote files...
tsch does that as well.
Jim
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 25/02/2013 07:59 PM, Warp wrote:
> Or you are deep inside a directory structure that's version-controlled by
> git (the .git directory being far upward in the directory structure).
> Among several files in the current directory, there's only one that's not
> being tracked by git. You write "git add " and press tab... and you can
> guess what happens.
I did this yesterday in Bash. I typed "hg add " and pressed tab. Of all
the dozens of files in the current folder, it immediately completed with
the single (deeply nested) file that I hadn't added.
I have literally no idea how it does that.
Annoyingly, if you type "systemctl restart x" and hit tab, it fails to
notice that xdm.service is the only possible completion...
...none of which has much to do with /scripting/ tasks, but anyway.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Am 25.02.2013 20:15, schrieb Orchid Win7 v1:
> Oh I'm *sure* there must be other things that could fail. If the disk
> was scratched I'd expect some non-deterministic yet spectacular failure
> (not much we can do about that), if the target drive has bad sectors
> that'll probably silently fail too, pressing Ctrl+C will probably break
> something...
You can bet on that.
That's what "trap" is good for.
Question is, which subset of all the existing signals do you need to
trap to be safe...
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Le 2013-02-25 15:01, Jim Henderson a écrit :
> On Mon, 25 Feb 2013 14:59:22 -0500, Warp wrote:
>
>> Well, that's nothing still. You start writing "scp somehost:" and press
>> tab, zsh will ask for your ssh password for that host, and then will
>> start completing the remote files...
>
> tsch does that as well.
>
> Jim
>
Begun the shell wars have.
--
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/* flabreque */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/* @ */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/* gmail.com */}camera{orthographic location<6,1.25,-6>look_at a }
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> Windows does a similar thing, except it uses \\?\PhysicalDisk0 as the
> name. And this "file" exists if and only if disk 0 is actually plugged in.
Yes, I use the \\?\{<drive_guid>} syntax to make sure my backups always
get written to the correct drive (with several hard drives and USB
storage devices connected I am never sure if the drive letters will be
repeatable).
> Linux now uses a system called UDev. Instead of the OS installer running
> mknod to generate device nodes for every device that could ever be
> plugged in, the actual /dev folder is empty. The UDev software then
> dynamically creates the appropriate device node when I device is plugged
> in, and deletes it when the device is unplugged again. In this way, only
> nodes for devices that actually exist show up.
>
> This is all very useful. But file redirection is such that if you
> redirect to an existing file, it is overwritten (the behaviour we want
> for our disk image), but if the file does /not/ exist, it gets created.
> And /dev isn't special; it's just a normal folder. The name /dev/sda is
> also not special; it's just a regular file.
I only have one annoyance left with my linux setup, I have the external
USB drive connected most of the time to it and it always appears as
/media/EXTERNAL (EXTERNAL is the drive name). However, if I boot it up
*without* the drive connected once, it will never appear again unless I
manually create the folder /media/EXTERNAL and reboot. I don't know
enough about what goes on behind the scenes to prevent this happening.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 26/02/2013 08:16 AM, scott wrote:
> Yes, I use the \\?\{<drive_guid>} syntax to make sure my backups always
> get written to the correct drive (with several hard drives and USB
> storage devices connected I am never sure if the drive letters will be
> repeatable).
The GUID is so huge that I'd never use that. (And if you ever reformat
the drive, I believe it'll change.) But *much* more reliable than using
the disk number, drive letter or similar.
> I only have one annoyance left with my linux setup, I have the external
> USB drive connected most of the time to it and it always appears as
> /media/EXTERNAL (EXTERNAL is the drive name). However, if I boot it up
> *without* the drive connected once, it will never appear again unless I
> manually create the folder /media/EXTERNAL and reboot. I don't know
> enough about what goes on behind the scenes to prevent this happening.
When the system starts up, it reads /etc/fstab and mounts everything
listed there (except entries marked as "noauto"). But it only does this
on startup. You can probably do "mount /media/EXTERNAL" to make it to
mount it any time you want...
...alternatively, some fluffy end-user helpy-helper tool is doing this,
in which case all bets are off.
This is the greatest problem with Linux. It's based on Unix, which works
in a defined way, but it's rather unfriendly. So now a mish-mash of
incompatible tools sit on top of it trying to make it user-friendly. And
it works great, most of the time. But when it breaks, suddenly you have
to know all this arcane crap again to figure out what's up.
(Oh, and your helpy-helper tool will NOT have any documentation...)
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> The GUID is so huge that I'd never use that. (And if you ever reformat
> the drive, I believe it'll change.) But *much* more reliable than using
> the disk number, drive letter or similar.
It's 24 hex digits, so yeh a bit long to put in every line. What I do is
do a mountvol to mount the external drive using the GUID to a temp
folder on my C drive, then instruct robocopy to backup to that folder.
It's not ideal (for several reasons) but robocopy doesn't seem to like
paths with the GUID directly.
> When the system starts up, it reads /etc/fstab and mounts everything
> listed there (except entries marked as "noauto").
Yes I've put it in fstab to mount the way I need, which all works fine
so long as I never boot it without the drive connected. If I do, the
entry in fstab stays unchanged (I assume some warning or error is thrown
somewhere), but next time I boot with the drive connected it doesn't
appear as /media/EXTERNAL - I have to manually create that folder and
then reboot (or manually mount it).
I suppose one workaround is to check that folder exists before fstab is
read. You'd also need to check the drive is actually connected though,
and then make that folder. Otherwise I'd end up with the same bug you
had where suddenly /media/EXTERNAL is just a normal folder on the local
storage. I have no idea how to do any of that though.
I miss on the Acorn where you could just reference drives by the name of
the disk in the drive. In windows why can't I rename my external drive
"backup" and then write to "backup:\", it even comes up in the Win7
address bar in explorer...
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> I miss on the Acorn where you could just reference drives by the name of
> the disk in the drive. In windows why can't I rename my external drive
> "backup" and then write to "backup:\", it even comes up in the Win7
> address bar in explorer...
>
Because DOS.
--
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/* flabreque */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/* @ */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/* gmail.com */}camera{orthographic location<6,1.25,-6>look_at a }
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>> I miss on the Acorn where you could just reference drives by the name of
>> the disk in the drive. In windows why can't I rename my external drive
>> "backup" and then write to "backup:\", it even comes up in the Win7
>> address bar in explorer...
>
> Because DOS.
Maybe that's because on DOS/Windows hard drives came along before
multi-tasking? So you never got the situation where you were swapping
floppies around to do several things at once in a multi-tasking
environment. In that situation it's very useful for the OS/app to know
which disc to use, rather than just which drive to use (otherwise you
end up saving your word processor document to your printer driver disc
and then can't find the latest version the next day).
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |