小编Sam*_*Sam的帖子

Shell脚本中的wait命令

fork(){
    i=0
    count=0
    while (($count<5))
    do
        fpfunction &
        pid=$!

        #Ensure the pid is available 
        if [  -z "$pid" ]; then
        echo "IS NULL"
        else
        Array[$i]=$pid
        echo "PID is $pid"
        fi

        wait [$pid]
        i=$((i+1))
        count=$(( count+1 ))
    done

    echo "PID: ${Array[*]}"

}
Run Code Online (Sandbox Code Playgroud)

fpfunction()只回显一个字符串,所以我不在这里写。

我对wait()的理解是它将等待子进程完成,然后返回一个值。

我在脚本中放入了wait(),因为我想确保所有子进程都已完成。

但是,发生错误

不是pid或有效的工作说明

我的理解错了吗?请让我知道如何解决此问题。

非常感谢。

bash

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

蓝牙低功耗 - 设备在交易中进入深度睡眠状态

当我读到有关数据交易的书时,

它提到一旦建立连接,两个设备都可以在事务之间进入深度睡眠状态.

我不太明白在交易过程中会发生这种情况.有谁能解释一下?

谢谢

bluetooth bluetooth-lowenergy

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

VIM how to replace "AA" to "BB" in a file

I need to replace a file which has thousand of lines code.

In the log, it has a specific word which I want to replace this work with some other words.

Say, how to replace all "AA" to "BB" in this file?

thanks

vi vim

0
推荐指数
2
解决办法
108
查看次数

使用aarch64-linux-gnu-gcc构建内核

我正在尝试使用以下命令在我的平台上构建内核源代码:

make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- generic-v8-defconfig
Run Code Online (Sandbox Code Playgroud)

但是,错误消息显示如下:

/bin/sh: 1: aarch64-linux-gnu-gcc: not found
Run Code Online (Sandbox Code Playgroud)

很明显我的笔记本电脑上没有安装这个gcc.

然后我跟着

http://www.howtoinstall.co/en/ubuntu/trusty/main/gcc-4.8-aarch64-linux-gnu/

这个要安装gcc-4.8-aarch-linux-gnu,

但是,我仍然得到相同的错误消息.

Ubuntu版本:14.04

如果你知道如何解决这个问题,请告诉我.

谢谢

gcc linux-kernel ubuntu-14.04

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

在ubuntu 15.04上安装Oprofile - 在/ usr/bin中找不到二进制文件

我试图通过以下链接在我的ubuntu 15.04上安装oprofile:

在Ubuntu上开始使用oprofile

在我在ubuntu 14.04上运行的另一台笔记本电脑上运行良好.

我可以在/ usb/bin目录下找到二进制文件.

但是,在输入apt-get命令后我不知道为什么

sudo apt-get update && sudo apt-get install oprofile
Run Code Online (Sandbox Code Playgroud)

我的ubuntu 15.04在/ usr/bin中仍然没有oprofiled&opcontrol二进制文件.

无论如何我可以检查一下吗?

谢谢

===================发布更新======================= 在此输入图像描述

linux ubuntu oprofile

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

如何检查我的蓝牙模块是否支持 Linux 中的 BLE 功能

我想知道这一点,因为我有一些 BLE 设备并且想检查我是否可以使用我自己的桌面蓝牙模块玩它。

linux bluetooth bluetooth-lowenergy

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