我想从特定行开始在bash中插入行.
每一行都是一个字符串,它是一个数组的元素
line[0]="foo"
line[1]="bar"
...
Run Code Online (Sandbox Code Playgroud)
而具体的行是'字段'
file="$(cat $myfile)"
for p in $file; do
if [ "$p" = 'fields' ]
then insertlines() #<- here
fi
done
Run Code Online (Sandbox Code Playgroud) 我想动态创建和填充一个数组,但它不能像这样工作:
i=0
while true; do
read input
field[$i]=$input
((i++))
echo {$field[$i]}
done
Run Code Online (Sandbox Code Playgroud) 我想将值修改为数组的元素,我不知道这样做的语法
for i in `seq 0 8`;
do
if [ ${config[$i]} = "value1" ]
then config[$i] = "value2" #<- This line
fi
done
Run Code Online (Sandbox Code Playgroud) 我想这样的添加项目只是到src/Acme的/ AdminBundle /实体/ Artist.orm.yml:
email:
type: string
column: email_address
length: 150
Run Code Online (Sandbox Code Playgroud)
但我不得不在文件Acme/AdminBundle/Entity/Artist中做同样的事情
/**
* @var string $email
*/
private $email;
Run Code Online (Sandbox Code Playgroud)
如果我不这样做,当我更新架构时它会显示错误:
php app/console doctrine:schema:update --force
Run Code Online (Sandbox Code Playgroud)
[Doctrine\ORM\Mapping\MappingException]
Acme\AdminBundle\Entity\Artist出错
[ReflectionException]
属性电子邮件不存在
我在开头使用yml选项生成了Bundle.
exec("wkhtmltopdf test.html output.pdf");
Run Code Online (Sandbox Code Playgroud)
在php命令行中它可以工作,但如果我尝试从apache调用它,它不会创建pdf文件,日志显示:
$ tail -f /var/log/apache2/error.log
wkhtmltopdf: cannot connect to X server
Run Code Online (Sandbox Code Playgroud)