我看到这个问题越来越流行了.我在下面回答了我自己的问题.什么说Inian是正确的,它帮助我更好地分析我的源代码.
我的问题出在了FIND而不是在RM.我的答案提供了一个代码块,我目前正在使用它来避免问题,当FIND找不到任何东西但仍会将参数传递给RM时,导致上面提到的错误.
以下老问题
我正在编写许多不同版本的相同命令.全部,执行但有错误/信息:
rm: missing operand
Try 'rm --help' for more information.
Run Code Online (Sandbox Code Playgroud)
这些是我正在使用的命令:
#!/bin/bash
BDIR=/home/user/backup
find ${BDIR} -type d -mtime +180 -print -exec rm -rf {} \;
find ${BDIR} -type d -mtime +180 -print -exec rm -rf {} +
find "$BDIR" -type d -mtime +180 -print -exec rm -rf {} \;
find "$BDIR" -depth -type d -mtime +180 -print -exec rm -rf {} \;
find ${BDIR} -depth -type d -mtime +180 -print -exec …Run Code Online (Sandbox Code Playgroud) 我无法让 Selenium 和 Chrome (Canary) 下载文件。我正在使用 Java 和 Chrome 59/60(因为我的测试适用于 Windows 和 Linux),并且我正在尝试开始从网页下载文件。
当我从 selenium 中不设置无头模式时,chrome 窗口将打开并下载文件。
当我设置标志时--headless,chrome 窗口不会打开,下载也不会开始。
public static void chromeDownload() throws IOException, InterruptedException{
ChromeOptions options = new ChromeOptions();
String downloadFilepath = "";
if (ValidateOS.isWindows()){
System.out.println("This is a Windows system.");
System.setProperty("webdriver.chrome.driver", "resources\\driver\\chromedriver.exe");
options.setBinary("C:\\Users\\Juri\\AppData\\Local\\Google\\Chrome SxS\\Application\\chrome.exe");
downloadFilepath = "C:\\";
} else if (ValidateOS.isUnix()){
System.out.println("This is a Unix system.");
System.setProperty("webdriver.chrome.driver", "resources/driver/chromedriver");
options.setBinary("/usr/bin/google-chrome");
downloadFilepath = "/home/juri/";
}
// Manage the download
HashMap<String, Object> chromePrefs = new HashMap<>();
chromePrefs.put("profile.default_content_settings.popups", 0);
chromePrefs.put("download.default_directory", …Run Code Online (Sandbox Code Playgroud) 我在, inCONCAT()上使用时遇到问题。WHEREPDO
编码:
<?php
require_once('config.php');
$fdate = '01/01/2010';
$tdate = '31/12/2030';
$identification = '';
$count = "SELECT count(*) as total FROM ( select time_id from doc_sent WHERE date >= :fdate AND date <= :tdate AND identification LIKE concat('%',:identification,'%') ) x;";
//$count = "SELECT count(*) as total FROM ( select time_id from doc_sent WHERE date >= :fdate AND date <= :tdate ) x;";
$stmt_count_row_main_table = $pdo->prepare($count);
$stmt_count_row_main_table->execute(['fdate' => $fdate, 'tdate' => $tdate, 'identification' => $identification]);
//$stmt_count_row_main_table->execute(['fdate' => …Run Code Online (Sandbox Code Playgroud) 我已经阅读了关于这个主题的所有其他问题,有很多。我尝试了一些,但在代码中没有发现错误。
我也尝试添加一个计时器来等待页面加载。
在html代码和java下面:
HTML:
<form id="myform" method="get" action="">
<input type="hidden" name="something1" id="something1.1" />
<input type="hidden" name="something2" value="" />
<table>
<tr>
<td><label>Name: </label></td>
<td><select name="name">
<option selected="selected" value="1000">FirstNameOnly</option>
</select></td>
</tr>
<tr>
<td><label>Direction: </label></td>
<td><select name="Direction">
<option selected="selected" value="">Choose One</option>
<option value="UP">UP</option>
</select></td>
</tr>
<tr>
<td colspan="2"><label>Time: </label></td>
</tr>
<tr>
<td><label>From: </label></td>
<td><input type="text" value="" name="from" id="id6"/>
</tr>
<tr>
<td><label>To: </label></td>
<td><input type="text" value="" name="to" id="id7"/>
</tr>
<tr>
<td><label>File type: </label></td>
<td><span id="id8">
<input name="fileType" type="radio" checked="checked" value="0" id="id8-0"/><label for="id8-0">Excel</label>
<input name="fileType" …Run Code Online (Sandbox Code Playgroud)