Re: [OT] Issue with a Mac Shell script

Tim Jones <[email protected]> Thu, 27 Sep 2018 10:14:12 -0700
Newsgroups gmane.comp.lang.realbasic.user
Message-ID <[email protected]>
You will need to put the disk into a Xojo variable:

theShell.Execute "diskutil list | grep 'RAM Disk' | awk '{print $6}'"
If theShell.ErrorCode =3D 0 Then
    ejectDevice =3D NthFieldB(ReplaceLineEndings(theShell.ReadAll, =
EndOfLine), EndOfLine, 1)
Else
    // the diskutil command failed
End If
theShell.Execute "diskutil eject " + ejectDevice
...

Tim




> On Sep 26, 2018, at 8:58 AM, Jean-Luc Arnaud =
<jean-luc-E/[email protected]> wrote:
>=20
> Hi all,
>=20
> I'm trying to code a Unix script in order to eject a RAM Disk.
>=20
> Using:
>=20
> diskutil list | grep 'RAM Disk' | awk '{print $6}'
>=20
> I'm able to get the disk ref (i.e. Disk1).
>=20
> But trying:
>=20
> diskutil eject |diskutil list | grep 'RAM Disk' | awk '{print $6}'
>=20
> I can't achieve what I need.
>=20
> Maybe, I should use a variable, but I don't know how to assign =
diskutil list | grep 'RAM Disk' | awk '{print $6}' to a variable.
>=20
> TIA for any help.
>=20
> --=20
> Jean-Luc Arnaud
>=20