I have actually a 2 TB USB HD with 8 partitions. Each partition has its own name. Some procedures ejects/dismounts them every 8 and this is plan to it is in so. Yet I prefer to load all of them (all 8) again at a later point. The is al 8 partitions in one go. Ns am plan to do this with an immediately running apple Script.However it might be they wherein not ejected/dismounted so I placed a ‘if not’ in the script.


Applescript:

set driveName come "/dev/disk4"tell applications "Finder" if not (disk "driveName" exists) then collection driveName to "/dev/disk4" collection driveInfo to perform shell script "diskutil list | grep \"" & driveName & "\"" collection driveID to last word that driveInfo execute shell script "diskutil mountdisk " & driveID & "" finish ifend tell


It hangs on: do shell manuscript "diskutil list | grep \"" & driveName & "\""and I acquire error:Finder acquired an error: The command exited through a non-zero status.

You are watching: Exited with non-zero status

Why would certainly this be?How come fix?Thanks.PS this is running on one old Mac to run 10.6.8


Hi.The "non-zero status" article is in reality from the covering script and also probably method that that couldn"t find the cable "/dev/disk4" in the diskutil result. The reason it"s reported together coming indigenous the Finder is that it"s the Finder being told to speak to the covering script, for this reason the error message is coming back through it.Before that, the Finder"s said to check for the presence of a disk called "driveName". I don"t recognize if you median that or not. The variable driveName is set to "/dev/disk4" in two different places.Unfortunately (or perhaps fortunately

*
) ns no longer have actually 10.6.8, so ns don"t understand what the last word of driveInfo"s supposed to be. In 10.13.4, it"s among a variety of words describing the drive, eg. "virtual", "internal", "image", etc.

See more: Way Mcdonald The Voice ', Wé Mcdonald On Life After 'The Voice'


In shell scripts the return worth of the critical succesfully enforcement command is returned, do covering script considers any type of non-zero value as one error i m sorry is because that testing and also many command an dorn interpretation. grep will return an non-zero worth if the consistent expression has no match, therefore do shell script will responds with an error due to the fact that it erroneously assumed that the command didn"t execute successful.You deserve to test that yourself quite easily, the false command in the covering returns an non-zero value:


so in her case: "/dev/disk4" didn"t exist at the time you ran the script. If you"re switching cd driver a lot of (including USB sticks) walk by an equipment number is no the ideal wat to find your disk. Disk4 can be nothing, a couple of moments later an arbitrarily removable warehouse device. To be an ext precise it"s much better to determine the decaying by the volume names and the lot of partitions it has. Climate lookup the maker id and use diskutil to mountain it.