GiselleSerate / myaliases

Useful shell aliases and functions.
6 stars 1 forks source link

Fix desk command (take 2) #45

Closed aryarm closed 6 years ago

aryarm commented 6 years ago

This fixes issue #42, at least for now. This certainly makes the desk command more complicated. So if issues with desk come up again, we might want to consider getting rid of the command altogether, especially since cds is perfect for this sort of stuff.

aryarm commented 6 years ago

One benefit to the new version of desk is that it will be faster to use, since the double quotes will force the evaluation of the mess of stuff contained in the subprocess $() when .bash_nav is sourced, instead of each time the alias is called.

The subprocess will open another subprocess to retrieve the current user's profile (ex: C:\Users\gsera) from Windows command line. Then, the first subprocess will use sed to remove everything before the last slash (yielding, for example, gsera). This result is echoed into the final alias such that the evaluated code becomes cd /mnt/c/Users/gsera/Desktop. Running alias desk verified that this is indeed the result.

GiselleSerate commented 6 years ago

bahahaha sed No really though, I think we might want to figure out a standard editor to use for these sorts of things. I used ed before because Someone On the Internet said it was better [citation needed]. Not sure it actually is better, and I might be overhauling the ed code anyway, but it's just something to consider.

aryarm commented 6 years ago

Ah ok. Let me know what you decide and I'll leave the branch open until then.