bashflags

Various flags in bash


I see many times flags such as if [-n ${Parameter}] or echo -n <string>. Sometimes, I have seen flags like -r and others used. However, I don't know how to search for the meaning of these flags on web. Could someone send me some link where I can understand as to what they mean or some general note as to how should I search for them on google? Thanks!


Solution

  • You can of course check the doc on internet https://ss64.com/bash/if.html

    Or if you have access to a linux or mac machine, just check out the installed doc !

    Try man if for example.

    Also, man could have multiple pages for the same query, for example man open will show the manual of openvt on my machine and is a command line executable. But writting man 2 open gives you the manual of the C open function. So by default man gives you manual of bash/command line and then C function. So man open could be written man 1 open

    This is really useful if you don't have an internet access or if the version of the tools that you want to use is different from the "normal" one. I think about sed for example, that is different from linux and mac. So they has different manual.

    Of course there is a man of man ... :) man man

    I forgot to talk about help, most (and decent) program has the -h or/and --help. Most of the time the manual page shows much more information.