标签: script

linux - bash - 读取:非法选项 -n

在 Ubuntu 上,我尝试暂停bash shell 脚本

!#/bin/bash
...
read -n 1 -p"pause"
Run Code Online (Sandbox Code Playgroud)

我到处都看到这种语法,所以我不明白为什么它不起作用

我收到这个错误

./build.sh: 14: read: Illegal option -n
Run Code Online (Sandbox Code Playgroud)

我也不明白的是,在阅读手册中,没有 -n -p 选项

Linux 中有两种不同的读取命令吗?

纯粹的

linux script shell

0
推荐指数
1
解决办法
2739
查看次数

如何使用 PowerShell 创建唤醒脚本?

可能的重复:
可以打开电脑的闹钟软件?

我需要一些可以在早上叫醒某人的东西 - 基本上就像cronLinux 中的一个事件。我认为这需要在 PowerShell 中完成,我对此一无所知。要求是:

  1. 它必须在指定时间(例如 07:00 小时)将计算机从睡眠中唤醒。
  2. 它将在那时播放 iTunes(或其他程序)中的指定歌曲。

就是这样!还具有脚本的 *NIX 版本的答案将受到青睐。

unix windows-7 script powershell cron

-1
推荐指数
1
解决办法
4392
查看次数

为什么这个“查找”命令会扫描所有目录?

我只想递归扫描Documents而不是离开那个“父”文件夹。我的脚本递归地扫描我的整个文件系统,我不确定这个脚本的哪个元素导致了这种情况的发生。这就是我所拥有的:

#/bin/sh
for f in $(find /home/rmintz/Documents/ -type f -name "*jpg")
do
  echo $f
done
Run Code Online (Sandbox Code Playgroud)

我需要改变什么才能让这个 bash 脚本只扫描Documents文件夹而不扫描其他任何东西?

我给人的印象是,这是扫描我的整个文件系统,因为终端中的输出显示/home/rmintz/Documents.

一个例子是/usr/lib

script bash bash-scripting

-1
推荐指数
1
解决办法
127
查看次数

这个密码脚本有什么作用?

在工作中的一个单位上找到了这个文件...

Set WshShell = CreateObject("WScript.Shell")
PINGFlag = Not CBool(WshShell.run("ping contoso.com -n 1 " & vSystemIdentifier,0,True))
      If PINGFlag = True Then
         'Successful ping
    'WScript.Echo "Connectivity to domain confirm."
    Call Password
      Else
         'Unsuccessful ping
    'WScript.Echo "No Connectivity to domain password check cancelled."
      End If



Function Password()

'========================================
    ' First, get the domain policy.
    '========================================
    Dim oDomain
    Dim oUser
    Dim maxPwdAge
    Dim numDays
    Dim warningDays

    warningDays = 15

    Set LoginInfo = CreateObject("ADSystemInfo")  
    Set objUser = GetObject("LDAP://" & LoginInfo.UserName & "")  
    strDomainDN = UCase(LoginInfo.DomainDNSName) …
Run Code Online (Sandbox Code Playgroud)

script passwords

-1
推荐指数
1
解决办法
245
查看次数

使用命令 find 的 Shell 脚本错误

我的脚本应该:递归查找名称包含给定字符串的文件和目录,使用find,从当前目录开始。如果没有给出参数,Missing argument(s)则应在将错误代码返回1给 shell之前打印消息。

这是脚本:

#!/bin/bash/
if ["${#}" -eq 0]
  then
     echo "Missing argument(s)"
     exit 1
else
  find .  -name "*$@*"
fi
Run Code Online (Sandbox Code Playgroud)

我试图在终端中使用它,但出现此错误: bash: ./myfind: /bin/bash/: bad interpreter : Not a directory

为什么?我的代码正确吗?

unix script bash find

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

Bash- 如何使 Linux 脚本文件人类不可读?

我见过许多可执行但无法读取的 Linux 脚本,因为它们是二进制格式。

我的问题是如何使我的脚本不可读/二进制格式?

linux script shell

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

如何每天在任务计划程序中运行网页?

可能重复:
如何在默认浏览器中按计划打开 URL?

明天我要去度假,我有 5 天不能上网。在我的 SO 帐户中,我连续 64 天访问。我不想失去这些日子。

我将我的 SO 配置文件保存在网页中并保存了我的桌面。

在此处输入图片说明

但是当我运行它时,打开file:///C:/Users/Soner/Desktop/Stack%20Overflow.htmurl。所以这对我不利。因为这不算连续一天的访问。

有什么办法可以做到这一点task scheduler吗?(就像每天自动运行一样。)

script webpage autorun windows-xp task-scheduler

-17
推荐指数
2
解决办法
3万
查看次数