shell

Useradd using crypt password generation

Hello, I am working on what I thought was a very simple script to dynamically create an FTP user using 'useradd' There are several parts of this process I am unfamiliar with, and an entire day's research has not gotten me too far. Here is what I have thus far: Notes: 1) HOME_DIR and GROUP are obviously erroneous, I have used these as pl...

RTMP: Is there such a linux command line tool?

Hello all, I have looked everywhere to find a linux utility that will allow me to download rtmp streams. Not flv video but MP3 streams. The location of the streams I want to download are in this format. rtmp://live.site.com/loc/45/std_fc74a6b7f79c70a5f60.mp3 Anyone know of such a command line tool? Or even anything close to what I am...

Extract history from Korn shell

I am not happy about the history file in binary format of the Korn shell. I like to "collect" some of my command lines, many of them actually, and for a long time. I'm talking about years. That doesn't seem easy in Korn because the history file is not plain text so I can't edit it, and a lot of junk is piling up in it. By "junk" I mean ...

Is there any difference between using typeset in ksh to simply setting a variable?

Are the following 2 lines completely equivalent? If not what's the difference? I've seen plently of shellscripts utilize number 1 and was just wondering what it gives you compared with number 2. typeset TARGET="${XMS_HOME}/common/jxb/config/${RUNGROUP}.${ENV}.properties" TARGET="${XMS_HOME}/common/jxb/config/${RUNGROUP}.${ENV}.proper...

How do I change bash history completion to complete what's already on the line?

Hi there, I found a command a couple of months ago that made my bash history auto-complete on what's already on the line when pressing the up arrow: $ vim fi [press up] $ vim file.py I'd like to set this up on my new computer, because it saves a lot of time when keeping a big history. The problem is that I can't for the life of me r...

launch X windows on client machine

Hi I have a shell script on a Unix box which when executed sets the DISPLAY variable dynamicaly to the clients ip address and if the client has some sort of x windows up and running then it launches say a program ike xcalc. I would want the shell script to launch the x windows say like exceed session on the winodws client when the shel...

Is there is a way to change a Windows folder icon using a Perl script?

Is there is a way to change a Windows folder icon using a Perl script? My intention is to change the ordinary icon of the "xxx_documents" folder to some other icon. I have to run the script in such a way that it takes care for the whole drive. The drive contains many folders. I have to search for each folder named "documents" (e.g. "xx...

Shell programming: Executing two applications at the same time

Hi I have two applications, lets call them APP1 and APP2. I would like that those two execute on parallel on my machine. It is not necessary, that they start at EXACTLY the same time but the should start at roughly the same time. An intial thought was to have a shell script that looks as follows: ./APP1 & ./APP2 Does this the trick ...

How to check with PHP if the script is being run from the console or browser request?

I tried things like $_ENV['CLIENTNAME'] == 'Console' but that seems to work on only certain OS's (worked in windows, not linux). I tried !empty($_ENV['SHELL']) but that doesn't work always either... Is there a way to check this that will work in all OS's/environments? Thanks! ...

Tab Completion feature in unix shell development

hi to all i am developing a shell using unix system programming (robbins and robbins) how can i add this feature and also how can i add history feature too (history feature like in BASH- when i press up key it shows the previous typed command ) ...

GNU readline History feature

I'm using this code for the history features in my shell: http://cc.byexamples.com/20080613/gnu-readline-how-to-keep-a-history-list-of-entered-command-lines/ but when I compile this using gcc, I got this error $ gcc filename.c /tmp/ccay2CgM.o: In function `main': rl.c:(.text+0x9): undefined reference to `rl_abort' rl.c:(.text+0x13): u...

Using sort to rank a column by its size

Hi everyone. I need your help. Let me tell you what my problem is. I have a text file as follows: Music 3.6G Other 254.5M Videos 4.6G Games 1.3G Apps 10.1G As you can see the file has two columns which consist of directory names and their appropriate sizes. What i want to do is to sort this file by directory's size in a decreasing o...

How to delete a part of the file with awk

Hi I'm writing a shell script, which at some point has to take a file, search for a particular word in it and delete the whole text that comes after this word (including the word itself) - awk is the right tool I suppose, but I don't really know much about programming in it. Could anyone help me? ...

How do i automatically set the $DISPLAY variable for my current session

I see that $display is set to localhost:0,0 if i am running over a vnc server this may not be correct, is there a way to automatically set it in my login script? ...

Get a list of delimited filenames from a text file

Hi, I'm really new to Bash, so this could sound silly to most of you. I'm trying to get a list of some filenames from a text file. Tried to do this with sed and awk, but couldn't get it to work with my limited knowledge. This is a sample file content: <?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 13.0.1, SVG ...

Redirecting Test Output

I'm using a bash script to automate a set of tests for some other code. The script looks like this: for i in $(seq 1 10) do cd ~/BuildBot rm -rf program # Remove the directory each time to test installation git clone /localrepo/ cd ~/into/program python2.6 setup.py build_ext -i cd tests python runtest.py >& ~/into...

Automated deployment of files to multiple Macs

We have a set of Mac machines (mostly PPC) that are used for running Java applications for experiments. The applications consist of folders with a bunch of jar files, some documentation, and some shell scripts. I'd like to be able to push out new version of our experiments to a directory on one Linux server, and then instruct the Macs t...

'app --help' should go to stdout or stderr?

I think stdout, so you can easily grep, what do you think? ...

Copying part of a large file using command line

I've a text file with 2 million lines. Each line has some transaction information. e.g. 23848923748, sample text, feild2 , 12/12/2008 etc What I want to do is create a new file from a certain unique transaction number onwards. So I want to split the file at the line where this number exists. How can I do this form the comma...

Is there a standard method to add to ENV variables conditionally on being empty?`

I am creating a script to configure and launch software. My current application requires appending to LD_LIBRARY_PATH. I know that I can test if this is empty first and set it outright and append it otherwise. The following does not appear to work and it keeps appending to the variable even if it contains the string I am testing for i...