4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

nyagosで`echo $PATH`とかしたい

4
Posted at

nyaos3000と違い、nyagosでは環境変数を展開するには%PATH%としなければなりません。
*nixやnyaos3000に慣れた人は$PATHとしたいところですよね。
nyagosでもfilterの機能を使って置換すれば可能です。

.nyagos
local _filter = nyagos.filter
nyagos.filter = function(cmdline)
  local post = cmdline:gsub('${([%w_()]+)}', '%%%1%%')
  post = post:gsub('$([%w_()]+)', '%%%1%%')
  return _filter(post)
end

$PATH${PATH}に対応してみたのですが、こんな感じで大丈夫かな?

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?