Re: [OT] Issue with a Mac Shell script
Jose Maria Terry Jimenez <[email protected]> Thu, 27 Sep 2018 19:37:06 +0200
| Newsgroups | gmane.comp.lang.realbasic.user |
|---|---|
| Message-ID | <[email protected]> |
Ok i see what you want with Tim's answer, so i'd try:
diskutil eject `diskutil list | grep 'RAM Disk' | awk '{print $6}'`
the output of the command between ` and ` is replaced in that position
Hope *this* helps :-)
El 27/9/18 a las 19:14, Tim Jones escribió:
> You will need to put the disk into a Xojo variable:
>
> theShell.Execute "diskutil list | grep 'RAM Disk' | awk '{print $6}'"
> If theShell.ErrorCode = 0 Then
> ejectDevice = 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:
>>
>> Hi all,
>>
>> I'm trying to code a Unix script in order to eject a RAM Disk.
>>
>> Using:
>>
>> diskutil list | grep 'RAM Disk' | awk '{print $6}'
>>
>> I'm able to get the disk ref (i.e. Disk1).
>>
>> But trying:
>>
>> diskutil eject |diskutil list | grep 'RAM Disk' | awk '{print $6}'
>>
>> I can't achieve what I need.
>>
>> 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.
>>
>> TIA for any help.
>>
>> --
>> Jean-Luc Arnaud
>>