shell

Bash script to mkdir

I am trying to create a directory based on a variable entered by a user and then save files there. I thought this would be simple enough for me but I get an error message "No such file or directory" when I try to save there. When I hit "ls" it lists the directory with a "?" after it. I am working with an .sh script on a Mac terminal....

maximize load but don't bring it to a crawl

I have a shell script that runs very cpu intensive programs. FFMPEG,ffmpeg2theora,etc. and I want to be able to run them but not choke the server. Is there something I can do to make sure the running programs are running as fast as possible but not hurting the server? Like a priority system...if something else comes along that needs it ...

C - System(""); Execute one at a time

Hello!, I've got a system("sudo apt-get update | sudo apt-get -y install apache2 zip unzip"); etc, but its doing all the same commands at once?, how do i make it so it does one after the other is finished?, also some may ask the user to enter information from apt-get, how do i allow this to show? ...

Override file icon in windows shell/explorer

Is there a way to override the icon and/or preview of a specific file format (my own) in Windows Explorer using C#? My files are xml files that contain a base-64 image, I'd like to display this image in Explorer as the file icon. ...

shell script detect first couple letters

I'm writing a shell script. A variable will have a url that will look at the the beginning few characters and make sure there is something before the //...so a http, https,rtmp,rtmps,rtmpe,etc.... if nothing is in front of the // then tell user there is nothing...else if that value = whatever do whatever How would I be able to do th...

BASH: how to perform arithmetic on numbers in a pipe.

I am getting a stream of numbers in a pipe, and would like to perform some operations before passing them on to the next section, but I'm a little lost about how I would go about it without breaking the pipe. for example > echo "1 2 3 4 5" | some command | cat 1 4 9 16 25 > Would you have any ideas on how to make something like this...

convert txt file with mixed spaces/tabs to tabs only (where possible)

Hi, I have some source code file which has mixed tabs/spaces and I want to convert it to a file where it has automatically replaced all indentation spaces by tabs for a given tab space length (i.e. for example tab = 2 spaces). Any easy solution (with common Unix tools, MacOSX, bash or zsh)? Some sed script or Python command or so? Tha...

Bash: recursively copy and rename files

I have a lot of files whose names end with '_100.jpg'. They spread in nested folder / sub-folders. Now I want a trick to recursively copy and rename all of them to have a suffix of '_crop.jpg'. Unfortunately I'm not familiar with bash scripting so don't know the exact way to do this thing. I googled and tried the 'find' command with the ...

awk shell script help

Hi i have the output of cat /proc/loadavg and /proc/meminfo MemFree: 1191220 kB i need a to know who will i get a script to get then added in a logfile every 5 mins. eg: CPU; Mem; 10.0; 1191220 and so on so the next entry will be below that eg: CPU; Mem 10.0; 1191220 5.0; 2229882 Thanks in advance ...

cannot understand command substitute in fish shell

In sh: ~$ `echo ls` bin/ Desktop/ But in fish: fish: Illegal command name “(echo ls)” ~% (echo ls) (Note that the error message appears above the command line.) ~% echo (echo ls) ls ~% eval (echo ls) bin/ Desktop/ fish: Illegal command name “(echo ls)” exec (echo ls) ^ ~% exec (echo ls) It seems that command substitution...

what object-based shells are there?

I am planning to write an object-oriented shell (based on Python). I have many ideas already. But before I am going to implement it, I want to inspire me by some existing shell. What I basically mean by object-oriented: Parameters are not just an array of strings but an array of objects. The return value is also an object. There is no...

How to get values between differents Shells/Displays - SWT

Hello everybody! I'm beginner in SWT and I have a question about get values between differents Sheels/Displays. I have 2 screens, one to sell and other to products' search. When I open a sale's screen, and found the product in search's screen, I need send to sale's screen, the result of search. The search's results are opened in a ta...

call shell command inside of a flash file

Hi! I want to create a basic GUI for a touchscreen panel running linux grml with fluxbox so I'm very restricted. The Gnash player is also available. Is there a way to call shell/bash commands inside a Flash file (swf)? I want to create a GUI to control the mplayer and volume with the touchscreen... If it's not possible with Flash, what ...

Send input to a program and get control back

Hello, I have been stuck on this for some time. Let's say I have a C program like the following. I want to be able to send this program some string and get the control after that. If I do: --> cat myfile | myprogram or --> echo "0123" | myprogram or --> myprogram < myfile I get the ouput (myfile contains "0123") 30 31 32 33 Usi...

IRIX bash shell expands expression in single quotes, yet shouldnt...

At the shell, I enter a single-quote and then carriage return and then a series of lines and then another single-quote: root@aim:/root > ' > @stat = lstat($ARGV[0]); > if (!@stat) { if (@stat = lstat($ARGV[0]);) { > print "nil\n"; > exit 0; > } > ' However, if you notice the interpreted output from the shell: bash: @stat = lstat($A...

Creating the same .tgz file on different machines

I'm using giternal, which compresses the .git directory of the external references into a .tgz file. Unfortunately, every time I "freeze" the external, a new .tgz file is created for the repo. Even though the contents of the .git directory are the same, a new .tgz file, with diffs, is created. This leads to repo bloat. Is there a way t...

Need help resolving Clover issue.

Hey Guys, Forgive me if the question is too vague. I am not a clover expert but i need this issue resolved. Clover seem to be having issues with a particular class as show in the trace below. I need to exclude this class entirely from the clovers part cause the class isnt all that necessary. Is this even a clover issue or just a java is...

emacs ansi-term background color

I'm having a problem changing the background color in ansi-term (and also term - but shell is fine). It displays colors fine from output but the background color of the out put is always white. Not the entire buffer, but just under actual characters that have been outputted. If I do something like (add-hook 'ansi-term-mode-hook (lam...

calling gawk from an R script

Hi i am using R on windows XP i have cygwin on my shell path what i want to do is send a command to gawk via R shell command this way: shell("gawk "{print $1}"", m[1],"_", h[i]."_79.7.dat""} i get this error Error: unexpected '{' in "shell("gawk "{" how can i fix this problem? Thank you ...

Rename files in bash keeping the originals untouched

I have a folder with a lot of images for a multilingual site, the images are stored in the next format filename.lang_code.jpg, on the deploy script i want to pick the correct one for the site I'm deploying and copy it to filename.jpg so I can share the same css between the sites. So, what I need is something like the command rename, but...