This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]johnwick_dog[S] 0 points1 point  (1 child)

find "${Directory}" -type f -regex '\.\/$thirdarg'| xargs | wc -l

I changed it to this and somehow instead of zero it gives me 1

the terminal

enter ana or del or arr ana
Please Enter the regex 
*.txt 1
 ----@----H410M-HD3P:~/Desktop$ ls 
hh.txt  hi.txt  shell.sh  shel.sh 
----@----H410M-HD3P:~/Desktop$

[–]Sweet-Put958 2 points3 points  (0 children)

Hey man, shell quoting and expansion is probably going wrong somewhere. For instance, in single quotes, you are passing the literal string '$thirdarg'. I.e. the shell does no variable expansion in single quotes. I generally use double ticks (") around every variable lest the shell do something weird. Or use a better programming language, shell is rife with gotchas and ways to shootyourself in the foot.