小编moa*_*a_u的帖子

如何检查命令是否成功?

有没有办法检查执行命令时是否有错误?

例子 :

test1=`sed -i "/:@/c connection.url=jdbc:oracle:thin:@$ip:1521:$dataBase" $search`
valid $test1

function valid () {
  if $test -eq 1; then
    echo "OK"
    else echo "ERROR" 
  fi
}
Run Code Online (Sandbox Code Playgroud)

我已经尝试过这样做,但似乎不起作用。我不知道怎么做

command-line

324
推荐指数
7
解决办法
66万
查看次数

如何修复外部硬盘只读?

我有一个外置硬盘 TOSHIBA 1TB USB 3,权限始终为只读。

fdisk -l(输出):

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf2198b37

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2046   362369023   181183489    5  Extended
/dev/sda3       362371072   976771071   307200000    7  HPFS/NTFS/exFAT
/dev/sda5            2048      976895      487424   83  Linux
/dev/sda6          978944   362369023 …
Run Code Online (Sandbox Code Playgroud)

permissions hard-drive

37
推荐指数
2
解决办法
23万
查看次数

如何安装 Cisco VPN 客户端?

在 Ubuntu 中安装 Cisco VPN 客户端应用程序的最佳方法是什么?

vpn cisco

25
推荐指数
2
解决办法
8万
查看次数

19
推荐指数
3
解决办法
6万
查看次数

是否可以将文件复制到 zip 存档中?

我想将文件复制到 ZIP 或 JAR 存档中。

那可能吗?如果是这样怎么办?

command-line zip

9
推荐指数
1
解决办法
1万
查看次数

将文件读入数组

如何在 shell 脚本中读取文件,然后将每一行分配给一个我可以稍后使用的变量,(我正在考虑从文件加载默认设置的方法)

我已经尝试过:

process (){

}

FILE=''
read -p "Please enter name of default file : " FILE

if [ ! -f $FILE  ]; then

    echo "$FILE : does not exists "
    exit 1
elif [ ! -r $FILE  ]; then

    echo "$FILE : can not read "
fi

exec 0<"$FILE"
n=0
while read -r line
do
   (assign each line to an variable) 
done
Run Code Online (Sandbox Code Playgroud)

command-line bash

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

需要一个比 zenity 更强大的 gui shell 脚本接口

我想编写一个带有多个输入框的 GUI 的 shell 脚本文件,供用户输入。我已经试过了zenity。任何想法或建议将不胜感激。

gui

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

Bash 脚本中的 sed 问题

我在使用sed命令时遇到问题。我正在尝试编写一个执行以下操作的 bash 脚本:

  1. 搜索包含的行 :@
  2. 然后保存包含的行:@并将其替换为新行

如下所示:

#! /bin/bash

echo "Please enter the ip address of you file"
read ipnumber
find=`grep ':@' application.properties` # find the line
input="connection.url=jdbc\racle\:thin\:@$ipnumber\:1521\:billz" # preparing new line
echo `sed "s/'${find}'/'${input}'/g" application.properties` # replace old with new line
Run Code Online (Sandbox Code Playgroud)

问题是:什么也没有发生。

我已经尝试使用"${find}" 而不是'${find}'

command-line bash sed

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

标签 统计

command-line ×5

bash ×3

cisco ×1

gui ×1

hard-drive ×1

permissions ×1

sed ×1

vpn ×1

zip ×1