What does 2>&1 mean here?

Before talking about redirections i have the feeling that you need to understand a basic thing: Linux commands produce normal output and error output, and unix gives you the freedom to “redirect” each output to a separate “channel” , called file descriptors (fd). Channel/fd 1 is used for std ouput and Channel/fd 2 is used … Read more

how to get the time after two minutes [closed]

To get the date-string in bash: echo “Current: ” $(date +”%Y”-“%m”-“%d”T”%H”-“%M”-“%S”) echo “+2 min : ” $(date –date=”@$(($(date +%s)+120))” +”%Y”-“%m”-“%d”T”%H”-“%M”-“%S”) prints Current: 2014-09-10T15-58-15 +2 min : 2014-09-10T16-00-15 Read the time from string and print +2min string str=”2014-09-10T15-58-15″ new=$(date –date=”@$(($( IFS=”-T” read y m d H M S <<< “$str”;date –date=”$y-$m-${d}T$H:$M:$S” +%s )+120))” +”%Y”-“%m”-“%d”T”%H”-“%M”-“%S”) echo “From … Read more

some problems about c++ try catch [closed]

Exceptions are brutal break of the normal flow of execution. The error correcting flow is to find a catch that correspond to the object thrown; this may lead to several function calls reverse traversal. This is why it needs care to use them, you have two flow of execution : the normal one, and the … Read more

Enhancement of unix script [closed]

Bash is not very performant doing loops. Since you tagged the question python, python should be ok? def data_mask(col_val): mod = len(col_val) + sum(map(ord, col_val)) % 10 result = “” for i, ch in enumerate(col_val, mod + 1): absnum = abs(ord(ch) – i) if ‘A’ <= ch <= ‘Z’: ch = chr(ord(‘A’) + absnum % … Read more

Some troubles with using sed and awk [closed]

From what we can discern of this question, you’re attempting to create a programmatic rule to rename files ending in extensions stdout-captured, stderr-captured, and status-captured (assuming one typo) into files ending in extensions stdout-expected, stderr-expected, and status-expected, respectively. Obviously, if each of these definitions is inclusive of exactly one file, a rote mv may be … Read more