我有 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) 我知道这是一个模糊的问题,但我将不胜感激任何指导。我的客户有一个电子邮件订阅者列表,他将 HTML 电子邮件发送到该列表。问题在于,当不同的电子邮件客户端查看时,电子邮件看起来不一致。例如,一封电子邮件在 Gmail 中可能看起来不错,但在 Outlook 或 AOL 中却很糟糕。
对于这个问题,是否有一种适合所有的解决方案?也就是说,是否有我可以使用的特定 CSS 规则等?谢谢你的帮助。
我正在将整个视频文件夹转换为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) 我希望默认情况下将光标显示在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) 我正在尝试使用 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)