小编Nih*_*vel的帖子

与'find'命令一起使用时出错'rm:缺少操作数'

我看到这个问题越来越流行了.我在下面回答了我自己的问题.什么说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)

bash rm operand

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

从 Selenium 和 chromedriver 下载文件

我无法让 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)

java selenium google-chrome download

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

Postgresql SQLSTATE[42P18]:不确定数据类型与 PDO 和 CONCAT

我在, 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)

postgresql pdo concat

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

Selenium 无法通过 id 和 xpath 找到元素

我已经阅读了关于这个主题的所有其他问题,有很多。我尝试了一些,但在代码中没有发现错误。

我也尝试添加一个计时器来等待页面加载。

在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)

java selenium

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

标签 统计

java ×2

selenium ×2

bash ×1

concat ×1

download ×1

google-chrome ×1

operand ×1

pdo ×1

postgresql ×1

rm ×1