The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

Views: 2,857β€…    Votes:  4β€…
Tags: command-line   bash   scripts   printing  
Link: πŸ” See Original Answer on Ask Ubuntu πŸ”—

Title: I don't want my ls command in my script to print results on screen
ID: /2019/10/11/I-don_t-want-my-ls-command-in-my-script-to-print-results-on-screen
Created: October 11, 2019    Edited:  October 11, 2019
Upload: November 24, 2022    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false

Updated Answer

After posting script used in the question it was discovered:

#!/bin/bash -x

was used where the -x option outputs all commands to the terminal.

Removing the -x solved the original problem.

Original Answer

You’re missing the argument flag indicator so this:

ls lX umbrella31_*log |  awk '{if($5 >=20000) {print}}' | wc -l

should be this instead:

ls -lX umbrella31_*log |  awk '{if($5 >=20000) {print}}' | wc -l

On my system looking for bash scripts it works like so:

$ ls -lX *.sh
-rwxrwxr-x 1 rick rick 4183 Jul  1 10:48
-rwxrwxr-x 1 rick rick  339 Jul 24 17:26
-rwxrwxr-x 1 rick rick  506 Jul 15 17:54
-rwxrwxr-x 1 rick rick   78 Jul  6 11:28

$ ls -lX *.sh | awk '{if($5 >=200) {print}}' | wc -l
⇧ When will Ubuntu 18.04 get kernel version 5.3? How do I disable all spectre/meltdown/l1tf mitigations on kernel 4.15.0?  β‡©