shell

os.system() execute command under which linux shell?

I am using /bin/tcsh as my default shell. However, the tcsh style command os.system('setenv VAR val') doesn't work for me. But os.system('export VAR=val') works. So my question is how can I know the os.system() run command under which shell? ...

How can I edit the $PATH on linux ?

Hi, I am using ubuntu 9.04 I need to add some folder to my $PATH. I know how to read the path: echo $PATH I want to be able to edit it and add 2 other paths. Thanks ...

Detect if shell script is running through a pipe

How do I detect from within a shell script if its standard output is targetting a terminal or if it's piped to another process? (Case in point: I'd like to add escape codes to colorize output, but only when run interactively, but not when piped, similarly to what ls --color does.) ...

Detecting the output stream type of a shell script

I'm writing a shell script that uses ANSI color characters on the command line. Example: example.sh #!/bin/tcsh printf "\033[31m Success Color is awesome!\033[0m" My problem is when doing: $ ./example.sh > out or $./example.sh | grep The ASCII codes will be sent out raw along with the text, mucking up the output and just gener...

Unable to convert dot-files to non-dotfiles safely

I run unsuccessfully in Mac mv .* * and mv .* ./* My files disappeared into thin air. How can you convert dot-files to non-dotfiles safely? ...

Bash shell for Windows?

Is there anything like bash shell in Windows with at least basic set of frequently used commands like ls, pwd, tail, etc? ...

Write a shell which can embed other application and run as a separate process

I found an interesting article from HP website. They wrote a TouchSmart Shell application, and it allows other applications to embed in that shell, and run as a separate process. Of course, HP defined some restrictions with the embedded application. I don’t know if C++ and Win32 can do similar thing? http://www.touchsmartcommunity.com/ar...

In Unix, how do I find out which executables or processes are using my shared libraries?

How do I find out which executables or processes are using my shared library objects in a Unix environment, specifically the AIX environment. Is there any command for it? ...

How to find information in a file using regular expressions on Linux

Hi, I have a file with many lines in it. One of them look like : set auto_upgrade {1 2 3 4} The list can contain more numbers. Now, in a shell script I want to look into this file and find out what is the last number in the list. In the example above, it should find 4. I have a regular expression to find this : set auto_upgrade {...

unix command line execute with . (dot) vs. without

At a unix command line, what's the difference between executing a program by simply typing it's name, vs. executing a program by typing a . (dot) followed by the program name? e.g.: runme vs. . runme ...

How do I write a bash alias/function to grep all files in all subdirectories for a string?

I've been using the following command to grep for a string in all the python source files in and below my current directory: find . -name '*.py' -exec grep -nHr <string> {} \; I'd like to simplify things so that I can just type something like findpy <string> And get the exact same result. Aliases don't seem sufficient since they on...

Add up a column of numbers at the Unix shell

Given a list of files in files.txt, I can get a list of their sizes like this: cat files.txt | xargs ls -l | cut -c 23-30 which produces something like this: 151552 319488 1536000 225280 How can I get the total of all those numbers? ...

Determining working directory of another program.

Is there any way of determining the current working directory of an already running program in Linux? What I'm trying to achieve is I want to be able to work in a terminal and then have a keyboard shortcut set up which will run a tool which I am writing which displays a little popup window containing some information and a few buttons t...

Problems importing database from vb.net

I’m trying to import a table into a secured sql database using vb.net but it seems to timeout (or so I think) and not import properly (null value), I truncate the table to save the field types and then call the shell() function to import the file and 'Clean out the existing data in the validation import table cmd.CommandText = "TRUNCAT...

How do I jump to the first line of shell output? (shell equivalent of emacs comint-show-output)

I recently discovered 'comint-show-output' in emacs shell mode, which jumps to the first line of shell output, which I find incredibly handy when looking at shell output that exceeds a screen length. The advantages of this command over scrolling with 'page up' are A) you don't have to scan with your eyes for the first line of the output...

Is there a command-line shortcut for ">/dev/null 2>&1"

it's really annoying to type this whenever I don't want to see a program's output. I'd love to know if there is a shorter way to write: $ program >/dev/null 2>&1 Generic shell is the best, but other shells would be interesting to know about too, especially bash or dash. ...

why unix sort command could sort a very large file?

the unix sort command can sort very large file like this cat large_file|sort how does the sort command implemented? why it doesn't cause excessive consumption of memory problem? ...

What's a good way to write batch scripts in C#?

I would like to write simple scripts in C#. Stuff I would normally use .bat or 4NT .btm files for. Copying files, parsing text, asking user input, and so on. Fairly simple but doing this stuff right in a batch file is really hard (no exceptions for example). I'm familiar with command line "scripting" wrappers like AxScript so that gets ...

A better Linux shell?

I use bash, and have done so for over a decade - but occasionally I wonder whether there has been any significant new developments in the world of Linux shells. A few years back Microsoft released PowerShell, which seemed very interesting. Is there any comparable innovation going on in Linux shells? ...

SU command issue Android device

Hi i want to change the folder permissions on device but when i type su i get permission denied is there any other way to do the same ..... ...