R. L. Dane :debian: :openbsd: on Nostr: Why didn't I think of this a long time ago? ``` function fopen { #"fzf-open" local ...
Why didn't I think of this a long time ago?
```
function fopen { #"fzf-open"
local selection="$(ls |fzf)"
local oIFS="$IFS"
IFS=$'\n'
[[ -n $selection ]] && open $selection
IFS="$oIFS"
}
```
(yes, I know fopen() is a C function. I just couldn't think of a better name than that or fzf-open, which is a pain to type)
Published at
2024-02-13 18:13:56Event JSON
{
"id": "ec9946c77d49863dab380da54f859be6232e4a767bf00b19c5ba648c9d959994",
"pubkey": "c95a71dfb95245bfb233a5ccea6dbcb03adda051221413144a54a206165aa52f",
"created_at": 1707848036,
"kind": 1,
"tags": [
[
"proxy",
"https://fosstodon.org/users/RL_Dane/statuses/111925528897745849",
"activitypub"
]
],
"content": "Why didn't I think of this a long time ago?\n\n```\nfunction fopen { #\"fzf-open\"\n local selection=\"$(ls |fzf)\"\n local oIFS=\"$IFS\"\n IFS=$'\\n'\n [[ -n $selection ]] \u0026\u0026 open $selection\n IFS=\"$oIFS\"\n}\n```\n\n(yes, I know fopen() is a C function. I just couldn't think of a better name than that or fzf-open, which is a pain to type)",
"sig": "494266e91d5a0f1999c72870cb446fd0e11dd3f7cf5986a4d74fdad53e2d89a92b02b64086f1dc64cd7ef2c682b6d447a38688febc6600d645565bada1dcc186"
}