General :: Unable To Use Functions With Bash

Dec 24, 2009

Code:

#!/bin/bash
#Functions
CallFunct() {
functio()

[code]....

When I try to run the current code, it stops on the bracket after functio() in CallFunct(). The only way I could get this to run was by removing CallFunct and just calling functio.

View 3 Replies


ADVERTISEMENT

General :: Passing Commands As Arguments To Functions In Bash Script?

May 31, 2010

I wrote a simple bash script to let me treat any set of programs like a deamon. For example if I configure the script a certain way I can start/stop/get the status of apache, mysql and php all from one command. I am having a bit of a problem though. I am passing commands as strings to a function and then depending on the arguments to the script it might run one of these commands or another. Some of these commands need to beun in the background though, such as deluge-web. When I send "deluge-web &" to the function and it execute it deluge-web does not start in the background. I can't figure out why this is. I have tried escaping the & with ''s and with a , but nothing seems to work. I know that this is some idiotic thing that I am overlooking, but I am a bit stumped. Here is the script configured to start/stop/get status of deluged and deluge-web.

Code:
#!/bin/bash
function checkanddosomething {

[code]...

View 3 Replies View Related

General :: Deleted The /etc/rc.d/functions Folder And Functions.d Script And Turned Arch Machine Into A Brick?

Mar 19, 2011

None of my daemon scripts work now, and the startup process displayed errors. Should I reinstall the OS and start from scratch, or is there a way to recover these files? Is there a way to rebuild the files I deleted?

View 2 Replies View Related

Programming :: Bash Script Cannot Run Functions - No Syntax Errors

Apr 23, 2011

I have this project which I've been working on essentially nonstop for the past three days and due to work I am running low on time. I'm new to Linux/Unix and my Teacher has assigned us a scripting project, due for Monday. I have All the functions for the project in a separate file which run as a daemon process when I log in. It has no syntax errors but my Script can not run the functions (I'm not sure where they go before or after the body) and I have one function I'd like you guys to take a look at. It has a Second menu leading to a case statement but it does not run after the Search. I'm Kinda tired of looking at the CLI but I have to finish this.

phoneEdi() {
directory=~/phonepro/directory
loop="y"
clear
tput cup 4 4; echo "Record Editor" .....

View 1 Replies View Related

Fedora :: Create A Shell Script File With Two Functions - Bash Scripting & /etc/bashrc

Oct 6, 2010

how come I can create a shell script file with two functions, I can execute the file, but when running declare -f, the functions are not on memory, and when invoking the function bash returns invalid. In the other hand, I can copy & paste the two functions at the end of my /etc/bashrc file.... then I can called the function by name.... and the commands within that function run on my session. here is a print of all my bash packets:

[Code]....

Does Fedora has restrictions on shell scripting? I haven't touch bash in seven years, so if things have change on it I'm behind on it, and sorry for my ignorance.

View 1 Replies View Related

Programming :: Global Bash Shell Functions - A.sh: Line 2: Echotm: Command Not Found

Sep 13, 2010

I wonder if there is anyway to make a user-defined bash shell function global, meaning the function can be use in any bash shell scripts, interactively or not. This is what I attempted:

Code:

$ tail -n 3 /etc/bashrc
echotm () {
echo "[`date`] $@"
}

[code]....

View 11 Replies View Related

Programming :: Unable To Use An Alias In The Ksh Functions

Apr 4, 2011

I have problem to use an alias that defined in ksh93 script,in the functions in the same script onm Linux.I definied an alias in main: alias echo='echo -e' in order that echo will read backslashes but when i executed it in function, the alias didnt work, and performewd a regular echo, without -e

cat test.ksh
#!/bin/ksh
alias echo='echo -e'
checkUsage

[code]....

View 1 Replies View Related

Fedora :: CUPS Server Has Hung / Unable To Do Any Admin Functions

Aug 25, 2011

My CUPS server has hung. Doesn't ask login user/pwd any more - goes straight to admin page. When I try to add printer I get an authorisation error. So unable to do any admin functions: add printers, disable Kerberos authentication etc.

View 1 Replies View Related

Programming :: Unable To Use Sleep() In Plugin Functions In Multithread Program?

Oct 11, 2009

I wrote a multithread program(c++,gnu gcc). it contains a main program and plugins. some functions in plugins use sleep(). Using these functions in threads cause freezing program. in other word thread sleeps but dosn't wake. How can i use sleep() in my plugin functions without this problem?

View 3 Replies View Related

Ubuntu :: MATLAB 7.3 Overflow In R_X86_64_PC32 Relocation - Unable To Run The Editor ,debug Scripts And Functions?

Mar 18, 2010

I have installed ubuntu 9.10 64-bit and MATLAB 7.3 _x86-64.When I run matlab launching script I get this error message and the program freezes:

/usr/local/matlab7.3/bin/glnxa64/MATLAB: Symbol `__kmp_test_then_add_real32' causes overflow in R_X86_64_PC32 relocation
/usr/local/matlab7.3/bin/glnxa64/MATLAB: Symbol `__kmp_test_then_add_real64' causes overflow in R_X86_64_PC32 relocation.

I tried to run "matlab -nojvm" and I get the same error as above but the program starts and seems to work smoothly. The problem is that I cannot run the editor and debug scripts and functions

View 4 Replies View Related

Programming :: Define Functions Within Other Functions In C++?

Mar 11, 2010

Is it possible to define functions within other functions in C++? I know it is the case in other languages.

View 2 Replies View Related

General :: Unable To Execute Simple Bash Scripts ?

Dec 24, 2010

All of a sudden,i can't execute a simple script as follows:

exit 0

and:

exit

View 18 Replies View Related

General :: Functions Of The Tar Utility?

Apr 30, 2010

What are the functions of the tar utility?

View 9 Replies View Related

General :: Change The Signature Of All The Functions In Scripts?

Mar 23, 2010

I was trying to write a script to change the signature of the all the methods in a set of scripts.. here is a sample of the same :

old signature :

methodname()
{
method-body
}

New signature:

function methodname
{
method-body
}

That is i need to insert "function" keyword in front of the methodname and remove the () after the methodname.

View 4 Replies View Related

General :: Pthreads - Executing Two Different Functions Simultaneously

Jul 1, 2011

In my code I want to have two different functions to be executed simultaneously (in parallel) in a single processor system. I tried to use pthreads but they happened to be executed one after another. I have heard about fork, some saying that its no longer recommended since its functions can be achieved by pthreads.

View 1 Replies View Related

General :: Script Has 5 Functions But Exits Only After 2nd Function?

Jan 25, 2011

Quote:
logcountfunction()
{
awk ' {
# when executing the script pass the logfile as parameter on the command prompt with the name of the file
#export file_name= "&1"

[Code]....

my problem is that when i execute this script only the first two functions are being called.once the DBcounttry_finalnofunc() is done ,the script exits.The rest of the functions are not being called.

View 1 Replies View Related

General :: Meaning And Functions Of Shell Symbols?

Mar 16, 2011

In shell scripting, what do or what does this symbol do or mean ? "."(octet), ";" (semicolon)? Would really like to know? Cause I saw a written script if [ -f /etc/file ];then. . /etc/file. Wondering, the "." is meant to be source, so is "." the same thing as "source" ?

View 2 Replies View Related

General :: Check The Referenced Functions In A Executable Through Command?

Oct 20, 2010

Is there any command that can check the referenced functions in a executable?

View 1 Replies View Related

General :: Use Inode Hook Functions(inode_alloc_security And Inode_free_security)?

Mar 4, 2010

how to use inode hook functions(inode_alloc_security and inode_free_security)?

View 1 Replies View Related

General :: Difference And Working Functions Between Kernel And Shell

Apr 4, 2011

I am the new child of the linux world. What is the difference and working functions between kernel and shell..

View 5 Replies View Related

General :: Warning Messages And Numerical Recipes Functions In C?

Jun 19, 2010

I am using some "Numerical Recipes in C" routines in my C code.(I am using ludcmp() & lubksb().)These are used to find inverse of a matrix.After compiling my c code, I get following warning messages.I have not understood them at all. What is the meaning of these and why did they pop up and how to remove them?

Code:
nrutil.h:11: warning: 'sqrarg' defined but not used
nrutil.h:14: warning: 'dsqrarg' defined but not used

[code]....

View 7 Replies View Related

General :: Belkin USB Wireless Functions Well In Jackalope But Fails To Connect?

Jun 12, 2010

I'm pretty new to Linux, but have had a bit of functional tutoring. i'm triple booting my old Dimension 8400. Have been running with Jackalope and XP for some time now and wanted to install Lynx and get a good handle on it before i completely wipe my other machine (Win7/Jackalope) and install it there.

Installed Lynx from a USB stick and all seems well, it recognises the UBS wireless and all available connections but just sits and spins on the password login and never connects...hmmm. I have tried all possible combinations of rebooting with the USB connected/disconnected/connecting after... to no avail.

The wireless seems to "work out of the box" just as seamlessly as it did for Jackalope, all the steps are similar, it just never connects.

View 6 Replies View Related

General :: Write A Literal Bash Command In A Bash File?

Nov 29, 2010

I create a bash script that writes another bash file. But in the generated bash file I want to write a bash command in the file and not executing it.Here's my bash file:

Code:
#!/bin/bash
cat > ~/generateGridmix2data.sh << END

[code]...

View 6 Replies View Related

General :: Running Bash But Common Bash Commands Not Working?

Jul 17, 2010

below are the details of my system. I have bash as my current shell, some really common commands aren't working.

Do I need to do a re-installation of bash? Or how do I install a selection of bash commands which I need? (for example a subset of [URL])

Code:
root@sdptfw:~ # uname -a
Linux sdptfw.sdpt.co.za 2.4.36 #1 Tue Jul 22 13:13:24 GMT 2008 i686 i686 i386 GNU/Linux
root@sdptfw:~ # echo $SHELL$
/bin/bash$

[Code]....

View 13 Replies View Related

Software :: Unable To Get To Bash After Booting

Feb 22, 2011

I have a linux system in a target board(Not GUI), which boots up and doesn't give me a bash prompt. So to get a bash terminal, I always need to telnet to it. (It is starting a telnet server during bootup) Please let me know how to get the terminal in the same window where it boots. In otherwords, once the rc.sysinit completes, I need to have a bash terminal there.

View 4 Replies View Related

Ubuntu :: Unable To Select <OK> Or <Cancel> In A Bash Dialog?

May 27, 2011

I am attempting to put a SystemRecoveryCD ISO onto a USB drive by using a shell script that is bundled with the ISO file (usb_inst.sh). When I run this script, I am presenting with a dialog box with a blue background (see attachment) with two options: <OK> and <Cancel>. I am able to switch between the options by using the arrow keys and Tab, but if I try to select an option by pressing Enter, O, or C, a new terminal line appears (as in the attachment), preventing me from selecting anything in the dialog. I feel like I'm not doing something extremely obvious;

View 3 Replies View Related

Programming :: Unable To Use SFTP File Upload Bash Script

Oct 7, 2010

upload a file to a business partner of ours in another country. Currently they have an SFTP server set up for us that I am using to download a daily generated file from a previous requirement. I use a bash script to download it since its fairly simple.

Quote:

sftp username@address/filename_filedate.zip /home/user/filedirectory > /var/log/joblog

(removed private info) To satisfy the new requirement I have been trying to write something similar to this;

Quote:

sftp /home/user/filedirectory/filename_filedate.zip username@address:/remotedirectory/

sftps manual page only gives a hint about using a batchfile, however i still cannot get it to work. Does anyone know another way? Or if you can even suggest another method or application? It seems like a bit of a cop out you can EASILY download using the sftp command but can't upload.

EDIT - forgot to mention I have already got keyless entry set up using ssh keys.

View 1 Replies View Related

Software :: Unable To Compile Gnome Commander - Bash: ./configure: No Such File Or Directory

Feb 2, 2011

I have downloaded the latest gnome commander source code from the gnome commander home page. Following the instructions in the readme I have extracted it from the tar ball and changed to the top level directory of the source code. I execute ./configure and get a bunch of "checking" results.

Quote:

bash: ./configure: No such file or directory
ken@ubuntu:~/Desktop/gnome-commander-1.2.8.9/src$ cd ..
ken@ubuntu:~/Desktop/gnome-commander-1.2.8.9$ ./configure

[code]....

I find Makefile.am and Makefile.in present in the directory. I generally install from deb packages. Still, I don't think it should be this hard to compile a package given the seemingly simple directions provided.

View 4 Replies View Related

General :: SSH Connection From BASH Script Stops Further BASH Script Commands

Dec 3, 2010

What happens when the script executes is that the ssh connection works and parks me at the remote hosts's shell login. Therefore, the "firefox" command refuses to execute. I need to know how to make the "ssh" connection occur, stay open, and go into the background so that the rest of the script can execute.If I could also do this with the "firefox" line so that the entire term window could be closed would also be helpful.

View 3 Replies View Related

Ubuntu :: 10.10 - Need Fn Key To Use F Functions

Apr 17, 2011

I have a Dell Inspiron Duo. Running Ubuntu 10.10 On my laptop, the enable/disable wireless and my F2 key share the same space and I need to press the Fn key to use F2 (I know supposed to go other way). But sometimes, they trade places. Where I that If I press the Fn key, it would enable/disable the wireless connections instead of doing F2.

What could be causing this and how do I stop it. This happens with not only my F2 key, but all the F functions. Also does anyone know how to reenable wireless after disabling it in Ubuntu. Pressing the enable/disable button does nothing after disabling and would require a boot to windows to reenable it.

View 3 Replies View Related







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