出于某种原因,当我执行以下操作: ls –color=auto 结果与: ls: illegal option — – usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file …] 不知道为什么发生这种情况,我想知道是否有其他人有同样的问题。
bash中的大括号和正常括号有什么区别? 仅供参考…我没有得到它在相关的问题清单,也无法find它的问题search。 请问我是否已经问过这个问题。
我需要为应用程序服务器设置环境variables。 例如: ORACLE_HOME , ORACLE_SID , JAVA_OPTS , CATALINA_BASE 。 我知道如何在Windows中设置系统环境variables,但没有Linux的想法。 我手动启动应用程序服务器,只需分配和导出它们,然后启动应用程序服务器(Tomcat,Oracle)。 但是如何为系统启动时自动启动的Linux服务设置环境variables? UPD 我使用Centos 5.4。 服务器用户的shell是/ bin / sh
我可以连接这个脚本从Linux到Windows RDP会话: #!/bin/bash /usr/bin/rdesktop -N -xm -u Administrator -p secret123 -d DOMAIN1 127.0.0.1:33891 (远程Windows服务器的rdp端口安全地通过本地主机上的端口33891) 但是这个脚本不能正确地传输密码: #!/bin/bash /usr/bin/rdesktop -N -xm -u Administrator -p #secret$123# -d DOMAIN2 127.0.0.1:33892 我该如何编码密码中的特殊字符? 我也想知道,如果我select/ bin / sh作为脚本的shell是否会有所作为。 编辑: 我发现这个作品: \ #secret \ $ 123 \#
好吧,我有一堆这种文件结构格式的文件。 /backup/daily/database1/database1-2011-01-01.sql /backup/daily/database1/database1-2011-01-02.sql /backup/daily/database1/database1-2011-01-03.sql /backup/daily/database1/database1-2011-01-04.sql /backup/daily/database1/database1-2011-01-05.sql /backup/daily/database1/database1-2011-01-06.sql /backup/daily/database1/database1-2011-01-07.sql /backup/daily/anotherdb/anotherdb-2011-01-01.sql /backup/daily/anotherdb/anotherdb-2011-01-02.sql /backup/daily/anotherdb/anotherdb-2011-01-03.sql /backup/daily/anotherdb/anotherdb-2011-01-04.sql /backup/daily/anotherdb/anotherdb-2011-01-05.sql /backup/daily/anotherdb/anotherdb-2011-01-06.sql /backup/daily/anotherdb/anotherdb-2011-01-07.sql /backup/daily/stuff/stuff-2011-01-01.sql /backup/daily/stuff/stuff-2011-01-02.sql /backup/daily/stuff/stuff-2011-01-03.sql /backup/daily/stuff/stuff-2011-01-04.sql /backup/daily/stuff/stuff-2011-01-05.sql /backup/daily/stuff/stuff-2011-01-06.sql /backup/daily/stuff/stuff-2011-01-07.sql 还有很多很多 最终我想导入所有2011-01-07.sql文件到我的mysql数据库。 这适用于一个 mysql -u root -ppassword < /backup/daily/database1/database1-2011-01-07.sql 这将很好地从这个备份文件恢复该数据库。 我想运行一个进程,它为所有数据库执行此操作。 所以我的计划是首先将所有的cp文件转换成tmp目录 cp /backup/daily/*/*2011-01-07*.sql /tmp/all 上面的命令不起作用我得到一个错误: CP:不能统计…..没有这样的文件或目录 所以你们可以帮我解决这个问题。 对于奖励点,如果你能告诉我如何做下一个步骤,即一次一个地执行一个命令导入所有的数据库,那也是很棒的。 我真的想在两个单独的步骤中完成这些工作,因为我需要在运行restore命令之前从tmp目录中手动删除一些sql文件。 所以我需要: 1)命令将所有2011-01-07 sql文件复制到tmp目录 2)命令将该目录中的所有文件导入到mysql中 我知道它可能在一个,但有很多原因,我真的希望分两步做。
file * | grep 'ASCII text' | chmod -x chmod: missing operand Try `chmod –help' for more information. 上面的命令给我error.Basically我试图find所有types为ASCII的文件,并将其权限更改为-x。上述语法中有什么错误?
我如何从我的bash历史logging执行一系列命令? 例如,如果我想在我的bash历史logging中执行编号为34到42的命令,我尝试了如下的操作: for n in $(seq 34 42); do exec \!$n; done 但是这并不是真正的诀窍,是吗? 有任何想法吗? 谢谢!
我正在做一个脚本,执行一些命令里面,这些命令显示一些输出在STDOUT (和STDERR以及,但这是没有问题的)。 我需要我的脚本生成一个.tar.gz文件到STDOUT ,所以在脚本中执行的一些命令的输出也转到STDOUT并以STDOUT无效的.tar.gz文件结束。 所以,简而言之,可以将第一条命令输出到屏幕(因为我仍然希望看到输出),而不是通过STDOUT ? 此外,我想保持STDERR不变,所以只有错误消息出现在那里。 我的意思是一个简单的例子。 这将是我的脚本: #!/bin/bash # the output of these commands shouldn't go to STDOUT, but still appear on screen some_cmd foo bar other_cmd baz #the following command creates a tar.gz of the "whatever" folder, #and outputs the result to STDOUT tar zc whatever/ 我已经尝试搞清楚exec和文件描述符,但我仍然无法得到它的工作: #!/bin/bash # save STDOUT to […]
如果在选定的文本中出现string“—– BEGIN PGP MESSAGE —–”,我想解密选定的文本。 我有下面的代码,但它不显示任何东西。 #!/bin/bash xsel > pgp.txt if [grep -e "—–BEGIN PGP MESSAGE—–" pgp.txt] then gnome-terminal –command "gpg -d -o decrypted.txt pgp.txt" gedit decrypted.txt fi 当我select一个文本后,在terminal上运行它说 line 3: [grep: command not found 我是新来的bash脚本。 任何帮助,将不胜感激。 谢谢
我有FreeBSd与OpenSSH运行。 我build立了一切,通过SSH连接完美。 然后我决定摆脱一些没有使用的端口,我明显卸载了一个由zsh使用的端口。 当我login时,我得到以下内容: ~ # ssh [email protected] Password: Last login: Wed Nov 7 21:56:26 2012 from 192.168.1.52 FreeBSD 9.0-RELEASE (GENERIC) #0: Tue Jan 3 07:15:25 UTC 2012 Welcome to FreeBSD! Before seeking technical support, please use the following resources: o Security advisories and updated errata information for all releases are at http://www.FreeBSD.org/releases/ – always […]