From 3e8c292a10eabd9816f7b0ccb9249661fbb4c3be Mon Sep 17 00:00:00 2001 From: Max Yankov Date: Sun, 18 Aug 2013 14:25:20 +0200 Subject: Bash: commands, attributes, ls, grep & pipe --- bash.html.markdown | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bash.html.markdown b/bash.html.markdown index 4e1eff9e..8cf7be18 100644 --- a/bash.html.markdown +++ b/bash.html.markdown @@ -44,12 +44,23 @@ if true then echo "This is expected" else - echo "And is was not" + echo "And this is not" fi # Expressions are denoted with the following format: echo $(( 10 + 5 )) +# Unlike other programming languages, bash is a shell — so it works in a context of current directory. +# You can list files and directories in the current directories with ls command: +ls + +# These commands have options that control their execution: +ls -l # Lists every file and directory on a separate line + +# Results of the previous command can be passed to the next command as input. +# grep command filters the input with provided patterns. That's how we can list txt files in the current directory: +ls -l | grep "\.txt" + # Commands can be substitued within other commands using $( ): # The following command displays the number of files and directories in the current directory. echo "There are $(ls | wc -l) items here." -- cgit v1.2.3