Programming :: Any Benefit To Code In KSH Or ZSH Instead Of Bash?

Jun 15, 2010

I have been scripting (or programming) in Bash shell for around 2+ years now. I have heard that ksh and zsh are better shells than bash. Are there any differences on the scripting side too, I mean is it easier to write a script in ksh or zsh rather than bash? Is there any benefit to code in ksh or zsh instead of bash.

View 1 Replies


ADVERTISEMENT

Programming :: How To Use Bash Variable In C Code?

Feb 16, 2011

I want to write a c program with some shell scripts.Now For a simple C program. I am Setting a variable called val2 in bash, now I want to use bash variable val2 in C code. How do I do that?The above doesn't work (coz its spawning a different memory space and when shell script ends the variable dies with it as per my research but how do I keep them in same memory space)Also Is there any Good reference where they teach how to integrate C and Bash Together?

View 5 Replies View Related

Software :: Benefit To Rewrite OSS-based Code To ALSA-based?

Aug 12, 2010

I've got some source code that loads and plays WAV files through the OSS drivers (and USB audio). The code works even under 2.6.34. Is there any benefit to rewriting the code using the ALSA system?

View 1 Replies View Related

Programming :: Passing Parameters From C Code To Bash Script

Apr 16, 2011

I get no print to stdout on screen from the C code.Does bash somehow block or mask it?I get print from bash. I get this error in the non-test bash script like: let "rdval = $rdstr"syntax error: operand expected (error token is " ")The let command prints rdval= but I presume this is due to the printf test statements getting in the way.I am getting no compile errors. Why does the C code not print the values specified?

View 2 Replies View Related

Debian Programming :: How To Do Code Bash Script To Run Su And Enter Password

Sep 15, 2014

Whats the bash script for like, how synaptic package manager runs ..

When you run synaptic it ask for root password ..

How do I do this in bash script?

View 5 Replies View Related

Programming :: Bash Script For Finding And Replacement In Any Webpage Code?

Feb 19, 2011

I want to write Bourne-shell script that will be to do finding and replacement in any web page code (.htm file) name of the tied folder in which have been saved pictures, .css, .js and other files. This folder create a web browser when we save web page completely and has so name as web page and has ending '_files'. I have many web pages where name of their folder are incorrect. Of course, my web browser shows these web pages without pictures. I can count amount of web pages in a folder (/path) needed for me.

1) find /path -type f -name "*.htm*" -print | grep -c .htm or find /path -type f -name *.htm | wc -l I can get list of web pages.

2) ls /path *.htm > out-list But I don't know how to assign the value from out-list (2) or result commands from pipeline (1) to a variable. Then I want to do next:

3)

var="1"
# where variable 'list' is an amount of web pages
while [ $var -le $list ]

[code]....

4)assign the 1st (then 2nd , etc. ) value from out-list (2) to variable 'webfile'
sed -n $var,+0p out-spisok

5)find the 1st string value '_files' in the 'webfile' grep -m1 _files $webfile

6)For example, 'abracadabra_files' is an incorrect folder in the 'webfile' I must to know start and end position 'abracadabra' without ending '_files', "cut" name of the incorrect folder and assign it to the variable 'finder' finder = 'abracadabra' BTW, name of a folder before '_files' is between '="' and '_files' in any web page code.

7)foldernew = $webfile (without '.htm')' foldernew' is equal with name of the tied folder without ending '_files' in the folder '/path'

8)find and replace in the 'webfile' and save result in the 'webfile-out'sed s/$finder/$foldernew/g $webfile > $webfile-out

View 5 Replies View Related

Programming :: Can Bash Commands Be Converted To Assembly Like C Source Code?

Nov 30, 2010

I have read where C is first converted to Assembly before its final compilation to binary. Is there a way to do this with Bash commands? I would like the understanding that Assembly allows to Bash somehow.

View 14 Replies View Related

Programming :: Kill Follow-on Code If Source Fails In Bash?

Dec 20, 2009

I have a Bash script that runs other bash scripts. If the parent code fails, is there any way for me to also kill the child code?That kills any multiple instances of a script if I run it more than once. Is there any way I can just modify this into something that prevents the child code from running/continuing from running if the parent stops from an error?

View 3 Replies View Related

Programming :: Bash-code To Rename Files Based On Config File

Apr 12, 2010

I'm writing a bash shell script that among various other things will traverse through a directory with hundreds of files and rename those who match a pattern found in a config file. It's expected that only about one in ten files will actually match, and those who don't, will simply just be ignored for this purpose.

This should for instance cause the file "dBase program file December 1987.prg" to be renamed "Clipper source code December 1987.prg", and conversely "C++ source August 1996.cpp" to be renamed "C source code August 1996.cpp" etc.A sample file such as "Random Data File.dat" should not be renamed here since it's not mentioned in the config file..What is the quickest, most elegant way to do this in bash?I am thinking of using bash's built-in regex matching combined with the /bin/rename utility, but don't quite know how to get started to catch this..I guess there are plenty ways of doing this in perl and elsewhere as well, but since this has to integrate into a pre-existing bash script, that's what I'm looking for.Anyone out there with a spare moment to offer a hint in the right direction?

View 14 Replies View Related

Programming :: Change A Line In A File Code - Sed Special Characters Bash Script

Jan 26, 2011

I'm having issue when trying to change a line in a file

[Code]....

View 1 Replies View Related

Programming :: Bash Code To Prevent Redundantly Including Files, Like Php's "include_once"?

Jul 13, 2010

I wrote some bash code to prevent redundantly including files, like php's "include_once". I've simplified it here so don't worry that it appears not to do anything:

Code: alias .='Include'
alias source='Include'
export __INC__functions=1

[code]....

View 1 Replies View Related

Programming :: Selenium Java Code Into Equivalent Php Code?

Mar 30, 2011

I need to rewrite the selenium java code into its equivalent php code.

View 5 Replies View Related

Fedora :: Zenity - Bash: [/code]: No Such File Or Directory

Apr 9, 2010

Awhile back, PabloTwo pointed me to zenity as a way to create bash scripts with changeable parameters. That thread is here, for anyone interested in reading about it: [URL] Anyway, my problem is that I'm trying to capture input that contains double-dashes ("--") but zenity (or maybe or it's bash???) complains with the following error message:

"This option is not available. for all possible usages.
bash: [/code]: No such file or directory"

Here's an example of what I'm doing:

Code:

# Select the time of day
Flytime=`zenity --list --text="Select the Time" --radiolist --height=300 --width=300 --hide-column=2 --column="Select" --column="Code" --column="Time of Day"
"" "--timeofday=real" "Local Time"

[code]....

What I want to accomplish is for the variable $Flytime to contain either "--timeofday=real" or "--timeofday=dawn" (without the quotes) depending upon which radio button is selected. I have tried escaping "--timeofday" (e.g. "--timeofday" and even "--timeofday") but that's not working.

View 3 Replies View Related

General :: Bash - Attaching Some Code To Session Start And End?

Jun 20, 2011

I'm trying to execute some code (let's call it login.java) when I log in and out of my linux machine. Is there any way to do this? I'm looking for perhaps a way to trigger the code? I've thought of just putting it in my .bash_login but preferably the code would launch on normal login, not when I start my terminal.

View 2 Replies View Related

Ubuntu :: JMF Without BASH - How To Code A Media Streamer In Java

Aug 31, 2010

I need to code a media streamer in java but I found out that I would need the java media framework to simplify the task. I downloaded the bin and need to export it into the files where my jdk packages are at by default. I'd rather not set my path variables because I'm not so good at interfacing with BASH. I just want to start nautilus in sudo and drag and drop like I did with my python packages. I am just having trouble locating the jdk lib.I'm not using openjdk but sun-jdk 1.6.18. My OS is Lucid. The package is JMF2.1.1e. I'm pretty sure I just need the just the lib files from it and none of the executable.

View 1 Replies View Related

Software :: Environmental Variables In BASH Source Code

Mar 17, 2011

My question has to do with how environmental variables are passed from parent to child processes at the BASH SOURCE CODE level. I have a need to add an environmental variable that has the complete invocation line so that the child process can see it via ENVP.I have been studying the source for a quite a while and can't seem to find how to make the variable pass to the child. In EXECUTE_CMD.c I found a good place to set the variable: I made a routine similar to PUT_COMMAND_NAME_INTO_ENV called PUT_COMMAND_LINE_INTO_ENV which would add "?=THE FULL INVOCATION LINE" as an environmental variable but it doesn't make it to the child. (I've tried names other than '?' but they don't work either.

I'm thinking that there is either a LIST or a attribute associated with those environmental variables that should be passed to the child but I can't find it.

View 1 Replies View Related

Programming :: Bash: Printing The Line Number In Bash Script?

Feb 4, 2011

I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.

View 3 Replies View Related

Programming :: Bash Ctrl+c Tarp And Bash Read With Timeout?

Jan 24, 2010

simple bash code:

Code:
#!/bin/bash
trap "echo 'you got me'" SIGINT SIGTERM # to trap ctrl+c
echo "Press ctrl+c during 5 sec loop"
for ((i=0;i<5;i++)); do

[Code]...

How come code behaves normally and stops when ctrl+c signal is caught and resumes, but after I use at least one timeout read in the code it looks like, if signal is caught again it doesn't pause the execution but skips the loop. If you remove -t (timeout) option from the read, both loops look the same!

View 10 Replies View Related

Security :: Write Secure Code For Bash Scripts In General?

Feb 9, 2010

how to write secure code for bash scripts in general? Strangely I didn't found anything in google and in the forum so far. If someone here is willing to review a bash script for me (about 600 lines).

View 6 Replies View Related

Programming :: Reading A Bash Variable In Bash Scripting ?

Nov 26, 2008

I have a config file that contains:

my.config:

Code:

Now in my bash script, I want to get the output /home/user instead of $HOME once read. So far, I have managed to get the $HOME variable but I can't get it to echo the variable. All I get is the output $HOME.

Here is my parse_cmd script:

Code:

View 3 Replies View Related

Programming :: Run Multiple Bash And Php Scripts From A Bash Script?

Jul 25, 2011

I have written quite a few separate bash & scripts and php scripts that up to now I have run from cron jobs. However I have to estimate how long each takes to run, before running the next and so it probably takes much longer than necessary to run them all. They have to run in order.

Now there are so many I am thinking it would be better to have a master bash script that would run one after the other, but I am not sure how to get the master script to wait before starting to run the next script. Is this possible and is there a command that will make the script wait between bash and php scripts , for them to finish, before running the next?

View 5 Replies View Related

Ubuntu :: Free-BSD OS Benefit In Certain Tasks ?

Feb 11, 2011

I Had used Windows but fed-up of his Crashes and Viruses, Therefor i decided to Check out Linux for the 1st time, so i installed Ubuntu and as time Passed, i just love it now..I had also used KDE Environment but a lot of bugs+Little slow KDE Compelled me to stuck with Gnome,And am fine with it......I seen a lot of more OS's which are for special purposes like Backtrack , Free-BSD , Fedora etc....But i don't know their Purpose , So the post Objective is to find their Purpose and Benefits....

First of all i want to know about Free-BSD OS benefit in certain Tasks... & Why would Someone use Fedora , Backtrack..?

Moreover, I am Home-User, but i am interested to know about these OS's benefits, Where they are used and why...? Is these OS's are not for Home-Users....?

View 9 Replies View Related

General :: What's Benefit Of Setting Up Yum Repository

Jan 17, 2010

whats the benefit of setting up a yum repository... aside from updating and installing softwares with this can it also upgrade /update the system.

View 1 Replies View Related

Programming :: Bash: Get Filename And Extension Using Bash?

Jan 9, 2010

I would like to get the filename (without extension) and the extension separately. The best solution I found so far is:

Let FILE="thefilenameofsomefilesfor_instance.txt"

Code:

NAME=`echo "$FILE" | cut -d'.' -f1`
EXTENSION=`echo "$FILE" | cut -d'.' -f2`

I think it would be better to count the len and remove 3 chars to right to get the extension, but it can be macintosh filenames with have 4 chars for extensions.

View 5 Replies View Related

Fedora Hardware :: Upgrade That Benefit Current Rig?

Feb 13, 2011

I do a lot of music based stuff using Ardour, Lmms and the like but had no problems, games, native ones run fine and can play L4d2 etc via wine without much trouble and look pretty enough to me. what would make my life so much better? Im thinking either more ran or new GFX. heres my specs. amd athlon 2 x2 black edition@ 2.8ghz 2 gig ddr2 800mhz samsung spinpoint F3 1tb hard drive xfx 7300 gs graphics emu 0404 sound card

View 5 Replies View Related

Ubuntu :: Any Benefit To Wiping Hard Drive?

Sep 17, 2010

Because I install/uninstall a fair few operating systems, I occasionally run Kill Disk off Hirens Boot CD to clean my drive.Being a 500GB Drive this takes about 12 hours.Is there any benefit to doing this? ie. drive longevity, speed, etc

View 5 Replies View Related

Fedora :: Text File Manipulation With Standard Commands In BASH - Remove The Stock Code

Oct 10, 2009

I need to do some text file manipulation which I think should be done with standard commands in BASH. I'm looking at comma seperated text files (stock market data). It comes in the form of date, stock code, open, high, low, close, volume. What I need to do first is move all data with same stock code sequentially into individual files.

While doing this since the stock code will now be the file name I need to remove the stock code. Next I need to filter out overlapping data from different files with the same date. ie. where two files contain the same date on the one line only one line will be added to the combined file. I think there must be a tutorial out there for basic text manipulation like this, I just haven't found it yet.

View 11 Replies View Related

CentOS 5 Networking :: Benefit Of Creating A Local DNS Server?

Feb 12, 2011

Wondering if the internal network will benefit of connecting to a local DNS server, rather than my ISP dns server. Can I create this local DNS server, without having an external domain, pointing to my server ?

All I want is faster lookup of known hostnames, both internally (hostnames) and externaly (cnn.com etc..)

View 10 Replies View Related

Security :: If Visiting An Https Website Is There Any Added Benefit To Tunneling Through Ssh

Apr 4, 2011

Basically, whenever I am on an unencrypted wireless hotspot, I open up an SSH tunnel to my home server to do all my browsing for the privacy and security it provides.But I got to thinking, and now I am curious, if I am visiting a site like gmail for instance that always uses SSL/TLS for it's connections, is there any added benefit to also using an encrypted tunnel? or is it perhaps superfluous to use both

View 3 Replies View Related

Programming :: Use SSE(2,3) In C/C++ Code?

Jun 6, 2011

I am working on a project with a lot of vector math and I'd like to find a way to speed it up.eading about SSE, but I've found no explanation on how to actually use it in code (was looking for some kind of hello-world example, complete with compilation instructions).Does the gcc compiler automatically make use of SSE, if you add the -sse(2,3) option on the command line? Or are their specific functions/libraries you need to call?

View 12 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved