How can I count all the lines of code in a directory recursively?

Try: or (when file names include special characters such as spaces) The SLOCCount tool may help as well. It will give an accurate source lines of code count for whatever hierarchy you point it at, as well as some additional stats. Sorted output: find . -name ‘*.php’ | xargs wc -l | sort -nr

Emulating a do-while loop in Bash

Two simple solutions: Execute your code once before the while loopactions() { check_if_file_present # Do other stuff } actions #1st execution while [ current_time <= $cutoff ]; do actions # Loop execution done Or:while : ; do actions [[ current_time <= $cutoff ]] || break done

Is bash a programming language?

We can say that yes, it is a programming language. According to man bash, Bash is a “sh-compatible command language”. Then, we can say a “command language” is “a programming language through which a user communicates with the operating system or an application”. From man bash: DESCRIPTION Bash is an sh-compatible command language interpreter that executes commands read from … Read more

Return value in a Bash function

Although Bash has a return statement, the only thing you can specify with it is the function’s own exit status (a value between 0 and 255, 0 meaning “success”). So return is not what you want. You might want to convert your return statement to an echo statement – that way your function output could be captured using $() braces, which seems to be exactly what you want. Here is … Read more

Using find command in bash script

Welcome to bash. It’s an old, dark and mysterious thing, capable of great magic. 🙂 The option you’re asking about is for the find command though, not for bash. From your command line, you can man find to see the options. The one you’re looking for is -o for “or”: That said … Don’t do this. Storage like this may work for simple … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)