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 πŸ”—

URL: https://askubuntu.com/q/1180236
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 aptfileparse.sh
-rwxrwxr-x 1 rick rick  339 Jul 24 17:26 checkrunning.sh
-rwxrwxr-x 1 rick rick  506 Jul 15 17:54 Downloads.sh
-rwxrwxr-x 1 rick rick   78 Jul  6 11:28 runall.sh

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