小编Avi*_*Avi的帖子

bash 脚本中意外标记“do”附近的语法错误

我有 bash 脚本,它从命令行获取 3 个参数。它比较目录中的所有文件,看它们是否属于前 2 个参数的类型。如果是,脚本将使用 FFMPEG 命令将此类文件转换为第三个参数的类型。我将使用以下命令执行脚本:

./convert.sh .avi .mp4 .flv 
Run Code Online (Sandbox Code Playgroud)

这样,此脚本会将所有 .avi 和 .mp4 文件转换为 .flv。

当我运行脚本时,出现错误

syntax error near unexpected token `do' in bash script.
Run Code Online (Sandbox Code Playgroud)

这是代码:

#!/bin/bash

# $1 is the first parameter passed
# $2 is the second parameter passed 
# $3 is the third parameter passed

for file in *.*; 
    do 
        #comparing the file types in the directory to the first 2 parameters passed
        if[  ( ${file: -4} == "$1" ) || ( ${file: …
Run Code Online (Sandbox Code Playgroud)

unix bash ffmpeg

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

如何创建 HTML 电子邮件以在所有电子邮件客户端中工作?

我知道这是一个模糊的问题,但我将不胜感激任何指导。我的客户有一个电子邮件订阅者列表,他将 HTML 电子邮件发送到该列表。问题在于,当不同的电子邮件客户端查看时,电子邮件看起来不一致。例如,一封电子邮件在 Gmail 中可能看起来不错,但在 Outlook 或 AOL 中却很糟糕。

对于这个问题,是否有一种适合所有的解决方案?也就是说,是否有我可以使用的特定 CSS 规则等?谢谢你的帮助。

html css email web

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

使用FFMPEG的Shell脚本转换为mp4会产生带有两次附加.mp4扩展名的新视频

我正在将整个视频文件夹转换为MP4。该脚本起作用,除了新视频两次附加了“ .mp4”。例如。转换后,“ video.mp3”将是“ video.mp3.mp4”。下面是shell脚本。TIA

#!/bin/bash
#Shell Script which converts all videos in a folder to MP4


for file in *.*; 
    do 
        if[ ${file: -4} != ".mp4"]   #don't want to convert mp4 files           
            ffmpeg -i "$file" "${file}".mp4 
done
Run Code Online (Sandbox Code Playgroud)

linux shell ffmpeg

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

默认情况下如何使光标出现在JTextField中?

我希望默认情况下将光标显示在JTextField"框"中.目前,我必须将光标放在框中才会出现.这是代码.

class XYZ extends JFrame implements ActionListener {

    JTextField box = new JTextField();
    JButton again = new JButton("Restart");
    JButton ext = new JButton("Exit");

    XYZ() {
        box.addActionListener(this);
        again.addActionListener(this);
        ext.addActionListener(this);

        box.setPreferredSize(new Dimension(20,20));
        box.setHorizontalAlignment(JTextField.CENTER)

        JPanel s3 = new JPanel(new BorderLayout()); //This holds the 3 panels below
        JPanel restart = new JPanel(new BorderLayout()); //this holds a button
        JPanel leave = new JPanel(new BorderLayout());   //also holds a button

        //The following holds a JLabel and the textfield
        JPanel middle = new JPanel(new FlowLayout(FlowLayout.CENTER,20,0)); 
        JLabel j2 = …
Run Code Online (Sandbox Code Playgroud)

java swing focus cursor jtextfield

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

无法让 Percentile_Cont() 在 Postgresql 中工作

我正在尝试使用 PostgreSQL 中的percentile_cont() 函数使用公用表表达式来计算百分位数。目标是找到余额最高的 1% 账户(此处称为金额)。我的逻辑是找到第 99 个百分位,这将返回那些账户余额大于同龄人 99% 的人(从而找到 1% 的人)

这是我的查询

--ranking subquery works fine
with ranking as(
       select a.lname,sum(c.amount) as networth  from customer a
       inner join 
       account b on a.customerid=b.customerid
       inner join 
       transaction c on b.accountid=c.accountid 
       group by a.lname order by sum(c.amount)
 )
select lname, networth, percentile_cont(0.99) within group 
order by networth over (partition by lname) from ranking ;
Run Code Online (Sandbox Code Playgroud)

我不断收到以下错误。

ERROR:  syntax error at or near "order"
LINE 2: ...ame, networth, percentile_cont(0.99) within group order by n.. …
Run Code Online (Sandbox Code Playgroud)

postgresql

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

标签 统计

ffmpeg ×2

bash ×1

css ×1

cursor ×1

email ×1

focus ×1

html ×1

java ×1

jtextfield ×1

linux ×1

postgresql ×1

shell ×1

swing ×1

unix ×1

web ×1