Programming :: Run A Part Of Code On Exit In A Shell Script?

May 14, 2010

How do i run a part of code on exit in a shell script?Suppose i have four echo statements like the following:

echo "Stmt 1"
echo "Stmt 2"
....some code goes here...

[code]...

View 2 Replies


ADVERTISEMENT

Programming :: Typeset -i Failing And Return Exit Code 1

Nov 18, 2010

I have this command in ksh:

1. typeset -i INTEGER INTEGER=aaa In all platforms except of Linux it is failing and return exit code 1 Why in Linux it is not failing? I must it for my number tests

2. The same for printf command. Only in Linux the bellow command is not failing: printf "%d" aaa

View 7 Replies View Related

Programming :: Script Exit Code To System() C Function?

Jul 3, 2009

Consider the following code:

Code:
...
int ret=0;

[code]...

View 4 Replies View Related

Programming :: Store Executable Code In The Value Part Of A Hash?

May 28, 2010

I was reading about Ruby code blocks, but it's all a bit hazy.My questions:1. Can you store executable code in the value part of a hash (err...associative array)2. If you did, how would you call the code?3. If you executed this stored code, would it be possible when doing soto pass in an object to the code that it could use?

View 1 Replies View Related

Programming :: Shell Scripts For Cutting And Pasting Part Of Data?

Mar 17, 2011

I have a tab-delimited txt file as below. It is part of the original file.Quote:

##Hello
##Welcome
#C1 C2 C3

[code]....

View 13 Replies View Related

Programming :: Extract A Part Of Flat File In Shell Script?

Feb 12, 2010

My rquirement is I have a flat file with lot of lines on it.example:

line1
line2
line3

[code]....

View 8 Replies View Related

Programming :: Shell Script To Delete Part Text Of A Line If Pattern Matches?

Apr 12, 2010

I am trying to create a shell script, on taking a input file as parameter, which need to do 3 things

1) create a copy of existing file.

2) add a new line to the copied file.

3) strip off all the absolute paths inside the copied file

The first 2 points are straight forward. but i am finding it difficult to acheive the 3rd point. myself not very good with awk and sed. but gave it a shot in vain. For example, the input script consists of below,

PROGRAM=`/usr/bin/basename $0`
HOST=`/usr/bin/uname -n`
echo Start $PROGRAM `/usr/bin/date` |
/usr/bin/tee -a $LOG

The output of the script should look like,

PROGRAM=`basename $0`
HOST=`uname -n`
echo Start $PROGRAM `date` |
tee -a $LOG

View 14 Replies View Related

Programming :: Array In Shell Script - Code Not Working

Oct 16, 2010

I am passing an array in function. I want to read the first content again and again until it is empty so

function calltoarray
{
read $1[0]
while [ ! -n "$1[0]" ]
do
echo empty
read $1[0]
done
}

But the code is not working. If we just press enter without value at read $1[0]. It do not get into while loop.

View 2 Replies View Related

Programming :: 32512 Error Code In Perl When Trying To Run Shell Command?

Nov 29, 2010

when I execute the command from the shell command line - it works and no error code.if I do the exact same command from a perl file - it fails with code 32512.the file is created from the same perl script that runs the command that fails. file permission is 0664.

Code:
#! /usr/local/pkg/perl-5.8.8/bin/perl
print "Content-type: text/html

[code]...

View 3 Replies View Related

Programming :: Exit In Script Files Cause Konsole Terminal Itself To Exit?

Apr 11, 2010

I noticed that if I have "exit" in a bash script file., e.g. script.sh,that when the word "exit" is reached, and the script file being executed is not in the PATH nvironment, i.e. ". script.sh", the whole konsole shell profile is exited! What gives here? Is there another command compatible to "exit" to prevent this, or will I just have the leave the "." part in the PATH enviroment, which is, to my understanding, is not recommended? I desire for a "goto" function in bash script files

View 11 Replies View Related

Programming :: Why New Threads Exit When Main Thread Exit

May 22, 2010

In linux, creating thread is same as process (clone()), except the virtual address space gets shared with the parent.If a running main process(thread) creates new thread, and if main thread exits, why should the new thread too exit? both are different entities, The same doesn't happen if the child thread exits, the parent thread would be alive.

View 1 Replies View Related

Ubuntu :: Code: /tmp/sXRap_kD.zip.part Could Not Be Saved

Dec 14, 2010

I've tried downloading xmind from their site as well as source forge and I keep getting this error message...

Code:
/tmp/sXRap_kD.zip.part could not be saved, because the source file could not be read.

Try again later, or contact the server administrator.How do I get this software and is this a problem on my end? I tried a few mirrors as well.[URL]..

View 1 Replies View Related

Ubuntu :: Error: Unmount Exited With Exit Code 1

Jul 10, 2011

using 'ntfs-config' to make ntfs partitions mount on bootup so that I can access my data partition from Ubuntu. The first time I installed ntfs-config it would not run. I uninstalled and reinstalled it and then it ran, but it didn't seem to be responding very well. I attempted to tick the partition I wanted and set it to be writeable. After I closed the app ALL my ntfs partitions were mounted, even the windows and system reserved partitions, and when I attempted to unmount them I got the following error:

Unable to unmount Data
Error unmounting: unmount exited with exit code 1:
helper failed with
unmount /dev/mapper/isw_dfjjdefcdi_RAID5p4 is not mounted (according to mtab)

I tried rebooting. I tried uninstalling ntfs-config, then reinstalling it (now it wont run again). So I'm at a loss as to what to do. I simply want my data partition mounted on boot up and writable, not the others.

View 4 Replies View Related

General :: Return -1 Of Main But Get Exit Code Is 255? Why? Pls Advise.

Jun 28, 2011

I learn C++ reading the <C++ primer 4th>, question1.2 let me test if return -1 how the compiler handle this exit code.
and in gcc (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52), I get this show:

[youxi600@Arthas C++ Primer]$ cat q1_2.cpp
int main()
{
return -1;
}
[youxi600@Arthas C++ Primer]$ gcc q1_2.cpp -o q1_2
[youxi600@Arthas C++ Primer]$ ./q1_2
[youxi600@Arthas C++ Primer]$ echo $?
255
[youxi600@Arthas C++ Primer]$
anyone can give me an advise? Many thanks!

View 13 Replies View Related

Ubuntu :: Error Mounting: Mount Exited With Exit Code 21

Oct 23, 2010

I have been running a live version on a 8 gig stick. Played nice for a couple of months but now when I try to access the native ntfs file system, I get the following error message.... Error mounting: mount exited with exit code 21: mount: according to mtab, /dev/sda6 is already mounted on /media/c

View 1 Replies View Related

Ubuntu :: Error Mounting: Mount Exited With Exit Code 2

Mar 26, 2011

My computer has been acting quite strange lately. It's been taking longer to boot, and my sound doesn't play anymore (Only a high pitched sound is heard, and no hardware for sound is detected). Just recently, my Windows 7 Partition returned the error of Disk Error Occured. Press CTRL+ALT+DEL to restart.

Any way I can fix my whole issue, I think my desktop is starting to die on me :O (And its only about 7 months old T_T)

View 4 Replies View Related

Ubuntu :: Error Mounting Mount Exited With Exit Code 13?

Mar 29, 2011

my windows xp system has recently been messed up, everytime i boot, i see the windows logo and then it reboots so i decided to liveboot ubuntu in order to recover the important files on my hard drive and then reboot. Problem is when i try to click on my "500GB Filesystem" I get this message.Unable to mount 500GB FilesystemError mounting: mount exited with code 13:ntfs_attr_pread_i:ntfs_pread failed:/input/output error Failed to read NTFS $Bitmap:Input/output error NTFS is either inconsistent, or there is a hardware fault, or it's a SoftRAID/FakeRAID hardware. In the first case run chkdsk/f on Windows then reboot into Windows twice.The usage of the /f parameter is very important! If the device is SoftRAID/FakeRAID then first activate it and mount a different device under the /dev/mapper/directory(e.g./dev/mapper/nividia_eahaabcc1). Please see the 'dmraid' documentationfor more details

View 1 Replies View Related

Debian :: (warning) Fsck Died With Exit Status 4 Failed (code 4)

Feb 19, 2013

My system has stopped to boot at all...

Code: Select alldone.
Setting parameters of disc: (none).
Setting preliminary keymap...done.
Activating swap...done.
Checking root file system...fsck from util-linux-ng 2.17.2

[Code] ....

An automatic file system check (fsck) of the root filesystem failed. A manual fsck must be performed, then the system restarted. The fsck should be performed in maintenance mode with the root filesystem mounted in read-only mode. ... failed!

The root filesystem is currently mounted in read-only mode. A maintenance shell will now be started. After performing system maintenance, press CONTROL-D to terminate the maintenance shell and restart the system. ... (warning).

Give root password for maintenance
(or type Control-D to continue): _

For now, I just don't know what I should to do next to my system has started to work again...

View 14 Replies View Related

Ubuntu Installation :: Ubiquity.components.partman Failed Exit Code 141

Jan 7, 2010

i am trying to install ubuntu from an SD card, i can run it from the card, and everything works fine, all but the install. i get to step 3 of 6. when pressing forward i get an error message ubiquity.components.partman failed exit code 141

View 1 Replies View Related

Ubuntu Installation :: Ubiquity.components.partman Failed - Exit Code 10

Apr 11, 2010

I am re-installing Ubuntu onto my desktop PC which has Windows 7, openSUSE 11.2 and Fedora Core 12. First I tried Ubuntu 9.10. Near the end of the installation the machine reboots and the monitor shows the following message:

"Ubiquity.components.partman failed - Exit code 10. Further info in /var/log/syslog"

Tried again with Ubuntu 10.04 beta2 with same problem.

How can I view and read /var/log/syslog if Ubuntu fails to be installed and therefore I cannot access this log?

View 1 Replies View Related

General :: Exit Mail In Shell Script

Feb 15, 2010

I have a shell script that creates a file and at the end I want to mail the contents of the file to myself or a group.

Here is what I have but I the script halts and I have to hit <ctrl-d> the n I receive an EOT and the mail is sent.

What I need:
- how to terminate the mail to where is terminates automatically
- can I cat the file contents instead of using -a

View 1 Replies View Related

General :: How To Exit Out Of The Calling Shell Script

Aug 18, 2009

I have 2 shell scripts, script1.sh and script2.sh. I call script2.sh from within script1.sh ( by simple ./script2.sh command). Based on some condition, i use exit 0 to exit out of script2.sh. I was trying to find if i can exit out of script1.sh as well at once. below is the example

script1.sh
#!/bin/bash
echo "Before ..."

[code]....

When i execute below is the output

Before ...
There was problem file is empty
The Script will Exit. Please fix the issue and run again...
After ...

I am trying to exit out of script1.sh as well so that i dont print "After ..."

View 3 Replies View Related

OpenSUSE :: When Open Project In Code Blocks And Click Build And Run, It Pop Out Debug Report And Exit After That?

Sep 3, 2011

When i open project in code blocks and click build and run, it pop out debug report and exit after that

View 3 Replies View Related

Ubuntu :: External Drive - Message - Error Mounting: Mount Exited With Exit Code 32

Mar 31, 2010

Accidentally the usb plug on my WD "My Book" got halfway unplugged and I didn't notice it. when I rebooted it, it wouldn't read the drive. I tried using G Parted to repair it but no success, it just runs forever accessing the drive and never finishes. (I left it running an entire weekend and it didn't finish) the drive is formated ext3.

When I try to mount the drive in Ubuntu 9.10 it gives this error message:

Strangely if I boot into Windows and use the ext driver I can access the drive just fine. is this something I can fix? if needed I can use Windows to do any repairs.

View 4 Replies View Related

General :: Shell Script Fails To Exit / Troubleshoot This?

Feb 9, 2010

This is a very simple problem, but I'm scratching my head with others..

In composing a simple shell script in class, we can't seem to get the script to execute fully. script was formatted as follows.

#!/bin/bash
echo "good bye for now"
exit

did, Chmod 755 to make executable
type file name "bye"
runs but wont exit.....
it just echos the type"good bye for now
The instructor says it works for him at home....
But it wont work in class...
Is there a reason it wont "exit" the shell as commanded ?

View 11 Replies View Related

Debian Hardware :: "Error Mounting: Mount Exited With Exit Code 1: Helper Failed With

Feb 12, 2011

I get the following message when trying to access my 1tb usb drive "Error mounting: mount exited with exit code 1: helper failed with: Error opening '/dev/sdr1': Permission denied Failed to mount '/dev/sdr1': Permission denied Please check '/dev/sdr1' and the ntfs-3g binary permissions, and the mounting user ID.More explanation is provided at [URL].. Really wierd thing is Linux Mint Debian reads it just fine

View 1 Replies View Related

General :: Debugger For Shell Script - Get Rid Of Multiple Exit Command ?

Jun 14, 2010

My two doubts:

(i) In office i open many terminal windows when i start my day and in each terminal i keep on login as different users many times in a day to do some task, by the end of the day when i need to exit from all terminals in a safeway instead of directly closing it i need to execute exit command or CTRL+D many times to close a single terminal safely. Can anybody tell me a way to exit from each terminal in single go, is there any command to acheive this ? I wish if we had a command like exitall like in vi we have :qa command to close multiple files opened in single window. I hope friends you have got what i am asking for ?

(ii) I want a software for debugging shellscripts searched a lot but dint got it.

View 7 Replies View Related

General :: Shell Command Equivalent To (Ctrl+C) To Exit From A Process?

Apr 1, 2011

I write a script to read a file which is something like a pipe (or) queue , which shows the running status.In normal case, if i open this file with cat command, i have to use ctrl+c to exit this . What command shall i use to do the same inside a shell script ? I have tried ^C in my script , but it does not exit the process.

View 6 Replies View Related

Ubuntu :: Expansion Drive Disconnecting - Error: Mount Exited With Exit Code 13: $MFTMirr Does Not Match $MFT (record 0)

Jun 1, 2010

I slipped on my expansion drive cable and it disconnected quickly, when I reconnected I got this error: Error mounting: mount exited with exit code 13: $MFTMirr does not match $MFT (record 0). Failed to mount '/dev/sdb1': Input/output error NTFS is either inconsistent, or there is a hardware fault, or it's a SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows then reboot into Windows twice. The usage of the /f parameter is very important! If the device is a SoftRAID/FakeRAID then first activate it and mount a different device under the /dev/mapper/ directory, (e.g. /dev/mapper/nvidia_eahaabcc1). Please see the 'dmraid' documentation for more details.

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







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