Re: [OT] Issue with a Mac Shell script
Jose Maria Terry Jimenez <[email protected]> Thu, 27 Sep 2018 19:32:40 +0200
| Newsgroups | gmane.comp.lang.realbasic.user |
|---|---|
| Message-ID | <[email protected]> |
El 26/9/18 a las 17:58, Jean-Luc Arnaud escribió:
> 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.
>
I suppose you don't want to parse the output of diskutil eject (thru
pipe) to diskutil list, so you could try:
diskutil eject && diskutil list | grep 'RAM Disk' | awk '{print $6}'
Executes diskutil eject and if it works then the rest ( diskutil list |
grep 'RAM Disk' | awk '{print $6}' )
Hope helps, not tested