Views:
3,776β
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:
September 15, 2024
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