Posts in 2021
-
Most votes on c questions 2
May 01, 2021 in FAQ
Most votes on c questions 2. #11 What is the difference between const int*, const int * const, and int const *? #12 How do function pointers in C work? #13 What does "static" mean in C? #14 How do I determine the size of my array in C? #15 How do I use extern to share variables between source files? #16 Why does the C preprocessor interpret the word "linux" as the constant "1"? #17 How to initialize all members of an array to the same value? #18 Obfuscated C Code Contest 2006. Please explain sykes2.c #19 What is the difference between ++i and i++? #20 What is the difference between a definition and a declaration?
Read all the top votes questions and answers in a single page. #11: What is the difference between const int*, const int * const, and int const *? (Score: 1501) Created: 2009-07-17 Last updated: 2020-12-19 Tags: c++, c, pointers, constants, c++-faq I …
-
Most votes on c questions 10
May 01, 2021 in FAQ
Most votes on c questions 10. #91 Is Fortran easier to optimize than C for heavy calculations? #92 How do you get assembler output from C/C++ source in gcc? #93 What is array to pointer decay? #94 Is It Possible to NSLog C Structs (Like CGRect or CGPoint)? #95 Which is better option to use for dividing an integer number by 2? #96 How can I get a file's size in C? #97 How do I print the full value of a long string in gdb? #98 How dangerous is it to compare floating point values? #99 How do you format an unsigned long long int using printf? #100 Fastest way to determine if an integer is between two integers (inclusive) with known sets of values
Read all the top votes questions and answers in a single page. #91: Is Fortran easier to optimize than C for heavy calculations? (Score: 422) Created: 2008-09-28 Last updated: 2018-01-28 Tags: c, performance, fortran From time to time I read that …
-
Most votes on c questions 1
May 01, 2021 in FAQ
Most votes on c questions 1. #1 What is the "–>" operator in C/C++? #2 Improve INSERT-per-second performance of SQLite #3 How do you set, clear, and toggle a single bit? #4 What is the difference between #include <filename> and #include "filename"? #5 Do I cast the result of malloc? #6 What does the ??!??! operator do in C? #7 What is the effect of extern "C" in C++? #8 What is ":-!!" in C code? #9 With arrays, why is it the case that a[5] == 5[a]? #10 Compiling an application for use in highly radioactive environments
Read all the top votes questions and answers in a single page. #1: What is the "–>" operator in C/C++? (Score: 9377) Created: 2009-10-29 Last updated: 2021-02-11 Tags: c++, c, operators, code-formatting, standards-compliance After …
-
Most votes on bash questions 9
May 01, 2021 in FAQ
Most votes on bash questions 9. #81 Syntax for a single-line Bash infinite while loop #82 Bash tool to get nth line from a file #83 How to kill all processes with a given partial name? #84 How do I prompt a user for confirmation in bash script? #85 Is double square brackets [[ ]] preferable over single square brackets [ ] in Bash? #86 How do I test if a variable is a number in Bash? #87 How to determine the current shell I'm working on #88 Check if pull needed in Git #89 Automatic exit from Bash shell script on error #90 Set environment variables from file of key/value pairs
Read all the top votes questions and answers in a single page. #81: Syntax for a single-line Bash infinite while loop (Score: 697) Created: 2009-08-17 Last updated: 2017-02-07 Tags: bash, loops, while-loop I am having trouble coming up with the right …
-
Most votes on bash questions 8
May 01, 2021 in FAQ
Most votes on bash questions 8. #71 How to do a recursive find/replace of a string with awk or sed? #72 Redirect stderr and stdout in Bash #73 When do we need curly braces around shell variables? #74 How to split a string into an array in Bash? #75 How does "cat << EOF" work in bash? #76 How to pass all arguments passed to my bash script to a function of mine? #77 How do I remove all .pyc files from a project? #78 Get current time in seconds since the Epoch on Linux, Bash #79 Find and kill a process in one line using bash and regex #80 How to use double or single brackets, parentheses, curly braces
Read all the top votes questions and answers in a single page. #71: How to do a recursive find/replace of a string with awk or sed? (Score: 756) Created: 2009-10-17 Last updated: 2018-05-12 Tags: bash, sed, awk, replace How do I find and replace …
-
Most votes on bash questions 7
May 01, 2021 in FAQ
Most votes on bash questions 7. #61 How can I exclude all "permission denied" messages from "find"? #62 Check number of arguments passed to a Bash script #63 How do I pause my shell script for a second before continuing? #64 Read a file line by line assigning the value to a variable #65 Extract substring in Bash #66 Why can't I change directories using "cd" in a script? #67 Redirect all output to file in Bash #68 How to 'grep' a continuous stream? #69 In a Bash script, how can I exit the entire script if a certain condition occurs? #70 Reliable way for a Bash script to get the full path to itself
Read all the top votes questions and answers in a single page. #61: How can I exclude all "permission denied" messages from "find"? (Score: 822) Created: 2009-04-17 Last updated: 2015-12-17 Tags: bash, error-handling, find, …
-
Most votes on bash questions 6
May 01, 2021 in FAQ
Most votes on bash questions 6. #51 How to call one shell script from another shell script? #52 Assigning default values to shell variables with a single command in bash #53 Given two directory trees, how can I find out which files differ by content? #54 What are the special dollar sign shell variables? #55 Count number of lines in a git repository #56 In Bash, how can I check if a string begins with some value? #57 Add a new element to an array without specifying the index in Bash #58 What does set -e mean in a bash script? #59 Add line break to 'git commit -m' from the command line #60 How can I write a heredoc to a file in Bash script?
Read all the top votes questions and answers in a single page. #51: How to call one shell script from another shell script? (Score: 870) Created: 2011-12-02 Last updated: 2019-12-07 Tags: bash, shell I have two shell scripts, a.sh and b.sh. How can I …
-
Most votes on bash questions 5
May 01, 2021 in FAQ
Most votes on bash questions 5. #41 How to compare strings in Bash #42 How to echo shell commands as they are executed #43 Parsing JSON with Unix tools #44 Replace one substring for another string in shell script #45 Propagate all arguments in a bash shell script #46 How to iterate over arguments in a Bash script #47 How to permanently set $PATH on Linux/Unix? #48 How do I clear/delete the current line in terminal? #49 Get current directory name (without full path) in a Bash script #50 Setting environment variables on OS X
Read all the top votes questions and answers in a single page. #41: How to compare strings in Bash (Score: 1046) Created: 2010-02-10 Last updated: 2018-11-18 Tags: string, bash How do I compare a variable to a string (and do something if they match)? …
-
Most votes on bash questions 4
May 01, 2021 in FAQ
Most votes on bash questions 4. #31 How to redirect output to a file and stdout #32 How to escape single quotes within single quoted strings #33 How can I declare and use Boolean variables in a shell script? #34 Passing parameters to a Bash function #35 How to reload .bash_profile from the command line? #36 Pipe to/from the clipboard in Bash script #37 How can I pipe stderr, and not stdout? #38 Listing only directories using ls in Bash? #39 Defining a variable with or without export #40 How to trim whitespace from a Bash variable?
Read all the top votes questions and answers in a single page. #31: How to redirect output to a file and stdout (Score: 1160) Created: 2009-01-07 Last updated: 2014-06-19 Tags: linux, bash, file-io, io, stdout In bash, calling foo would display any …
-
Most votes on bash questions 3
May 01, 2021 in FAQ
Most votes on bash questions 3. #21 How do I prompt for Yes/No/Cancel input in a Linux shell script? #22 Check existence of input argument in a Bash shell script #23 Difference between sh and bash #24 Make a Bash alias that takes a parameter? #25 How to convert a string to lower case in Bash? #26 How to specify the private SSH-key to use when executing shell command on Git? #27 echo that outputs to stderr #28 What is the preferred Bash shebang? #29 How to count lines in a document? #30 YYYY-MM-DD format date in shell script
Read all the top votes questions and answers in a single page. #21: How do I prompt for Yes/No/Cancel input in a Linux shell script? (Score: 1571) Created: 2008-10-22 Last updated: 2020-03-04 Tags: linux, bash, shell, scripting I want to pause input …