All Questions

905
votes
14answers
111764 views

UTF-8 all the way through

I'm setting up a new server, and want to support UTF-8 fully in my web application. I have tried in the past on existing servers and always seem to end up having to fall back to ISO-8859-1. Where ex...
395
votes
9answers
241162 views

Why does printf not flush after the call unless a newline is in the format string?

Why does printf not flush after the call unless a newline is in the format string? Is this POSIX behavior? How might I have printf immediately flush every time?
277
votes
3answers
73345 views

Difference between single and double quotes in Bash

In Bash, what are the differences between single quotes ('') and double quotes ("")?
920
votes
13answers
1037855 views

How to set a variable to the output from a command in Bash?

I am working on a simple scripting project for work that involves the use of Bash. I have a pretty simple script that is something like the following: #!/bin/bash VAR1="$1" VAR2="$2" MOREF='sudo r...
31
votes
4answers
2879 views

Why should there be a space after '[' and before ']' in Bash?

I was trying to write a Bash script that uses an if statement. if [$CHOICE -eq 1]; The script was giving me errors until I gave a space after [ and before ] as shown below: if [ $CHOICE -eq 1 ];...
139
votes
6answers
285680 views

How do I use shell variables in an awk script?

I found some ways to pass external shell variables to an awk script, but I'm confused about ' and ". First, I tried with a shell script: $ v=123test $ echo $v 123test $ echo "$v" 123test Then trie...
196
votes
6answers
163808 views

How to terminate a python subprocess launched with shell=True

I'm launching a subprocess with the following command: p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) However, when I try to kill using: p.terminate() or p.kill() The command ...
9
votes
2answers
12508 views

Facing an error "*** glibc detected *** free(): invalid next size (fast)"

Please see MSO question A long list of possible duplicates — C memory allocation and overrunning bounds for information about closely related questions. Developer environment: CentOS 4.7, Kdevel...
100
votes
7answers
94973 views

Multiple glibc libraries on a single host

Multiple glibc libraries on a single host My linux (SLES-8) server currently has glibc-2.2.5-235, but I have a program which won't work on this version and requires glibc-2.3.3. Is it possible to ha...
58
votes
3answers
19417 views

printf anomaly after "fork()"

OS: Linux, Language: pure C I'm moving forward in learning C programming in general, and C programming under UNIX in a special case. I detected a strange (for me) behaviour of the printf() function ...

Previous Next