unix

Naming conventions in UNIX C functions (_t and _st)

I notice that there are some function return types named *****_t or ******_st. What do "_st" and "_t" mean? ...

How to check if a shell command executed properly or not?

#!/bin/sh tar=$1 if [ -f $tar ] then tar xvf $tar else exit 1 fi ... <more code> I need a conformation that the tar actually happened successfully, otherwise abort the execution of the script. The tar file extract might not go through because some problems with tar command access issues with $tar Do Linux utilities have s...

Can a child process pass the environment variable back to parent process

Consider the following: $ cat t.sh echo "This is from t.sh" eval "t2.sh" echo "\$FROM_t2=$FROM_t2" $ cat t2.sh echo "This is from t2.sh" export FROM_t2="env_var_from_t2" I want to read the value of "FROM_t2" created by t2.sh into t.sh. Is this possible? ...

Shell Script Certification

Hi guys, I'm a UNIX shell script programmer, and I would like to know if there is any certification specific for Shell (bash, korn,etc) programmers. Could you help please? Also how about CX-310-105 exam to take Oracle Solaris Associate, does it have value on the market? Thanks ...

is "unix" restricted keyword in C?

This code does not compile for me on gcc version 4.3.2 (Debian 4.3.2-1.1) main(){ int unix; } I've checked the C keywords list and "unix" is not one of them. Why am I getting the following error? unix.c:2: error: expected identifier or ‘(’ before numeric constant Anybody? ...

How can I enable ctrl-c / ctrl+break after calling system?

I have written a program that invokes a system command from inside: #include <stdlib.h> int main(void) { while(1) { system("ls 2>&1 1>/dev/null"); // comment this line out to enable ctrl+break } return 0; } However, when it is running, CTRL+C and CTRL+BREAK no longer work and appear to be ignored. I am tryin...

in vi "y5w" yanks five words from cursor position

in vi "y5w" yanks five words from cursor position? ...

Why do du and Perl's -s give different values for the file size?

Updated According to comments: I have outlog.txt file which contains multiple filenames, e.g: 2345_535_Dell&HP_3PAR_DEAL.txt, similarly there are many filename but not the actual folder where the files are located and so in code am appending filenames to folderpath to get actual file location. Now,I want to get disk usage of all the fil...

Porting a large C project from Unix to Windows

So, I have a large C project that was built entirely on Unix (SPARC Solaris). me and several others have begun to revisit it because their was some interest in a windows build. none of us have done this with a project of such size, so for starters, has anyone ported something from unix to windows and could maybe give me some pointers or...

using grep or awk to find files that contain both "a" and "b" that are on different lines

Is there a way to use grep or awk to find text files that contain both e.g. "a" and "b" but in this case "a" and "b" are on different lines? ...

Regarding UNIX Variable Date Format

Hi, I have a date value stored in a unix korn shell variable VALUE="2010_09_23" I want to change it to "23-Sep-2010" and store it in VALUE1. How can i do it? VALUE1="23-Sep-2010" ...

Why don't people use c++ to make operating systems

Why are Linux, MacOS and other operating systems written in C and not in C++? Isn't C++ C with new features? ...

how create cron command

how can i call some url like stackoverflow.com from cron without getting return data from page? ...

Why is my Perl system command giving me a syntax error?

The Perl script that contains a Unix command to grep the ethernet NICs cannot be executed within the script! I have tried "qx" , $var and "system" but it does not seem to work! The codes: #!/usr/bin/perl use warnings; use strict; use Term::ANSIColor; print "\nYou are now in Showing Ethernet Cards!\n\n"; print "*********************...

Is the constructor of a class from a shared library exported?

I hav a a shared library lib.so containing a class Foo. I'm dynamically loading (with dlopen on UNIX) lib.so. After loading I want to create an instance of Foo. Can I simply use new operator to create an object of Foo, or I would have to create an exported factory method placed in lib.so that will create that object for me? Actually t...

How to change a file format from rows to columns?

file format change : top to bottom <> left to right input file format: 100 150 200 300 500 output file format should be: 100,150,200,300,500 I need to apply this in reverse, too. ...

TMUX key bindings

Hi, I have a problem with TMUX key bindings. When I'm working on a terminal pane, if I press ctrl+pgup, it should scroll the screen one page up, as a normal terminal, but it doesn't. Also, while using VIM, I have mapped to do some actions, but this key combination is not called. Any TMUX expert there?. ...

How can I run multiple jobs from a large queue at the same time in Perl?

I would like to program bsub job limits into my Perl script which launches lsf jobs under the hood. If I have something like 2000 jobs, I would like to run at max 20 jobs at any given time. I would prefer that the jobs running is max 20. I seen scripts where people launch 20 jobs and wait for it to finish before launching another 20. ...

shell script remote execution using python

Is there a way that I can use Python on Windows to execute shell scripts which are located on a remote Unix machine? P.S: Sorry about the late edit. I do know of Paramiko, but I wanted to know if there is way of doing it without it. For starters, could it be done with subprocess()? ...

Why doesn't my shell script work when I run it from Perl?

I have this command that I load (example.sh) works well in the unix command line. However, if I execute it in Perl using the system or ` syntax, it doesn't work. I am guessing certain settings like environment variables and other external sh files weren't loaded. Is there an example coding to ensure it will work? More Updates on codi...