Code Monkey home page Code Monkey logo

Comments (7)

kloneets avatar kloneets commented on July 20, 2024

Ok, I looked closer to code and se, that trimming is performed afterwords with javascript, so, line could be just:
'df | grep ' + drive + ' | grep -oh \' /.*\''

from nodejs-disks.

jssuttles avatar jssuttles commented on July 20, 2024

Yeah. I've run into this as well. (Check out my fork.)
I switched it with this:
'df -kl | grep ' + drive + ' | awk '{ for (i = 9; i <= NF; i++) print $i}' ORS=' ''
Not the best because it assumes that the 9th is the beginning of the mount point. What if the first parameter has a space in it?
What does yours do?

from nodejs-disks.

kloneets avatar kloneets commented on July 20, 2024

Mine just finds row with drive and asumes that / will be last param with "/" (slash), which will be the mount point. So - it returns everything from this /. Extra space will be trimmed by javascript.

from nodejs-disks.

jssuttles avatar jssuttles commented on July 20, 2024

Does that get "/Volumes/some drive"?

from nodejs-disks.

kloneets avatar kloneets commented on July 20, 2024

In my case it did :D

from nodejs-disks.

jssuttles avatar jssuttles commented on July 20, 2024

A case where that would fail is if the mount point folder has a trailing space ('/Volumes /some drive'). I think that's less possible than the first field having a space in it. So, it's a better solution than mine. Do you know if it's possible?

from nodejs-disks.

kloneets avatar kloneets commented on July 20, 2024

Never saw such mountpoint naming, but users are geniuses and, if someone allows to do this, they will :D
I just tested on my mac (el capitan) and my solution worked on flahsdrive called " My flash " (space before "My" and after "flash"). So - need to be tested on other platforms :)

from nodejs-disks.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.