小编rei*_*kus的帖子

如何在CentOS中退出nl命令?

我真的是CLI中的菜鸟,所以请帮助我.我不小心在CentOS中输入了nl,现在我被困在这个列表中.我如何退出nl?

谢谢你的帮助!

command-line command centos

4
推荐指数
1
解决办法
6722
查看次数

如何将其与一个javascript对象组合?

我有这个代码,它正在工作.

var URL = new Object();

URL.pattern = /https?:\/\/([^\/]*)\//;
URL.current = window.location.href;

URL.getCurrent = function(){
  return this.current.match(this.pattern)[1];
};

var thisDomain = URL.getCurrent();
Run Code Online (Sandbox Code Playgroud)

现在我想要的是将点符号放入对象中,我该怎么做?我试过这个,但是当我调用URL.getCurrent()时它显示为undefined.

function URL(){

  this.pattern = /https?:\/\/([^\/]*)\//;
  this.current = window.location.href;

  this.getCurrent = function(){
    return this.current.match(this.pattern)[1];
  };
}
Run Code Online (Sandbox Code Playgroud)

我希望有人可以帮助我.

javascript syntax object

2
推荐指数
1
解决办法
132
查看次数

用于自动化的 JavaScript (JXA) 中的 Application.make

我正在尝试转换这个现有的 AppleScript 脚本:

tell application "System Events"
  make login item with properties {path:"/Applications/Application.app", hidden:false"}
end tell
return
Run Code Online (Sandbox Code Playgroud)

这是我到目前为止所拥有的:

#!/usr/bin/env osascript -l JavaScript

'use strict';

ObjC.import('stdlib')

function run(argv) {

  var systemEvents = Application('System Events')

  systemEvents.make({
    new: 'LoginItem',
    at: systemEvents.loginItems,
    withProperties: {
      name: "Application",
      path: "/Applications/Application.app",
      hidden: false,
      kind: "Programm"
    }
  })

  $.exit(0)
}
Run Code Online (Sandbox Code Playgroud)

但是,我被困在以下行中,因为我实际上不知道要传递给该new:属性的内容,所以我认为其他属性是正确的。

 new: 'LoginItem',
Run Code Online (Sandbox Code Playgroud)

我希望有人能指出我正确的方向。

macos applescript javascript-automation

2
推荐指数
1
解决办法
998
查看次数