相关疑难解决方法(0)

在bash中传递带空格的字符串作为函数参数

我正在编写一个bash脚本,我需要将包含空格的字符串传递给我的bash脚本中的函数.

例如:

#!/bin/bash

myFunction
{
    echo $1
    echo $2
    echo $3
}

myFunction "firstString" "second string with spaces" "thirdString"
Run Code Online (Sandbox Code Playgroud)

运行时,我期望的输出是:

firstString
second string with spaces
thirdString
Run Code Online (Sandbox Code Playgroud)

但是,实际输出的是:

firstString
second
string
Run Code Online (Sandbox Code Playgroud)

有没有办法将带空格的字符串作为单个参数传递给bash中的函数?

bash function

153
推荐指数
5
解决办法
19万
查看次数

travis-ci上的scipy ImportError

我是第一次成立Travis-CI.我以我认为的标准方式安装scipy:

language: python
python:
  - "2.7"
# command to install dependencies
before_install:
  - sudo apt-get -qq update
  - sudo apt-get -qq install python-numpy python-scipy python-opencv
  - sudo apt-get -qq install libhdf5-serial-dev hdf5-tools
install:
   - "pip install numexpr"
   - "pip install cython"
   - "pip install -r requirements.txt --use-mirrors"
# command to run tests
script: nosetests
Run Code Online (Sandbox Code Playgroud)

一切都在建立.但是当测试开始时,我得到了

ImportError: No module named scipy.ndimage
Run Code Online (Sandbox Code Playgroud)

更新:这是一个更直接的问题演示.

$ sudo apt-get install python-numpy python-scipy python-opencv
$ python -c 'import scipy'
Traceback (most recent call last):
  File …
Run Code Online (Sandbox Code Playgroud)

python scipy travis-ci

17
推荐指数
2
解决办法
4292
查看次数

标签 统计

bash ×1

function ×1

python ×1

scipy ×1

travis-ci ×1