LoginSignup
4

More than 5 years have passed since last update.

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

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}に対応してみたのですが、こんな感じで大丈夫かな?

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