Programming :: Detection Of A Command In Shell?

Apr 2, 2010

I would like to know if there is any way to detect a command if it going to be executed in the shell?

Eg:
Cmd: sudo apt-get clean I want a C program to be called before this cmd is executed.

View 8 Replies


ADVERTISEMENT

Programming :: Show The Output Of Shell Command Into A Textbox, Ex Ps -efc Command?

Oct 20, 2010

I am using gtk to program GUI. How can I show the output of shell command into a textbox, ex ps -efc command ?

View 3 Replies View Related

Debian Programming :: How To Use Shell Command

Sep 6, 2013

How to use shell command?

installs.sh:

Code: Select allapt-get install icedove-l10n-hu
apt-get install rar
apt-get install ...
...
y press key or other language is other key. hungarian key is: i

english after apt-get install in gnome-terminal: (y)es or (n)o
hungarian after apt-get install in gnome-terminal: (i)gen or (n)em

How to yes or no automatically in all languages? Not manual, not 'Y'/'I' or 'N'/'N' keydown.

I would like use this script my fresh installed Debian 7.1. I would like run this install.sh when Debian is installed for my all softwares when i would like use.

10 PC installing easy and faster my script.

If no script is slowly install for my 10 PC.

View 2 Replies View Related

Programming :: Executing Shell Command In JSP

Aug 24, 2010

what we are trying to do is, to let the customer click a button in the web browser, and then the web server to call a shell script to do the work. The output from the stdout && stderr of the script should be displayed in the web browser once finished or timeout, along with the exit code of the script.

The shell script is however not on the web server, but on another app server. So to call this script from the web server as the identity 'tomcat':

Code:
$ sh appuser@app-server:$appbin/app-script

The .ssh/id_rsa.pub thing is done, and we have no problem doing this in the command line so far.

Our loaded ex-colleage has left us the webpages (jsp) with code like these:

Code:
<%@ include file="jsp_functions.jsp" %>
<%
String cmd = "sh $appbin/app-script";
ExecResult r = new ExecResult();

[Code].....

View 6 Replies View Related

Programming :: Process More Than 3 Hours Old From Shell Command?

Nov 14, 2010

My server pretty often becomes full up php processes running which are not needed. Is there a way to search for and kill any php process that is more than 3 hours old?

View 7 Replies View Related

Programming :: Pass A Shell Variable To An AWK Command?

Dec 23, 2010

I have the following code :

Code:
E_BADARGS=65
if [ $# -ne 2 ] ; then

[code]...

View 1 Replies View Related

Programming :: Can't Invoke A Command From Within Shell Script / Sort It?

May 17, 2010

When I try to invoke 'source' command from within a shell script, namely, myscript.sh, I get the following error message code...

View 1 Replies View Related

Programming :: Kill Process More Than 3 Hours Old From Shell Command?

Nov 15, 2010

My server pretty often becomes full up php processes running which are not needed.Is there a way to search for and kill any php process that is more than 3 hours old? as I understand it, i need to use ps piped with awk. awk at the moment seems very complicated to me, do not how to start tackling it.

View 5 Replies View Related

Programming :: Execute A Shell Script (with Source Command)?

Nov 19, 2010

This is weird. I have a shell script with no execute rights.$ chmod -x test.shThen I try$ test.shwhich does not work. (I have "." in PATH)When I do$ . test.shit works! I can run the script even though I have no execute rights. Why is that?Another question: If I have a shell script without a hash bang, I still can execute the shell script. Why? What does hash bang do? If there is no hash bang, why is the shell script run? What does the hash bang do

View 9 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 :: Firing Some Shell Command Like Ls - Mkdir Dir-name Via Kernel Module

Jun 10, 2010

How can we fire a shell command like ls,./a.out automatically in kernel space via a kernel module ? i.e. replacement of system() function of user space into kernel space.We need to develop a kernel module which can fire some shell command let say "firefox [url]" automatically to open google automatically from module.

View 2 Replies View Related

Programming :: Write A Replacement For Shell Command Line Interpreter?

Sep 2, 2010

If say, I want to read the input given by user at the command prompt and write a code to execute the cmd given then which commands do i use to implement this ( Im writing the code in C )?

View 8 Replies View Related

Programming :: Processing A Command Line Literally (without Shell Quoting)

Aug 31, 2010

Does anyone know a method of being able to process the complete and literal command line passed to a shell script ? I want to have the command line parameters with ALL characters (including meta characters e.g. $ literally).

So as if there was no shell to substitute or expand parameters nor applying it quoting rules.

View 5 Replies View Related

Programming :: Creating Array From Command Output (Bash Shell Script)

Jan 26, 2011

I have a command that outputs n lines of text, and I want to place each line into an array element, but I can't seem to get the syntax correct

So my command is this:
cat $configfile | sed -n '/cluster:'$clustername'/,/cluster/ p' | awk /host/

Which produces many lines depending on the value of $clustername. I'd like to get each line as elements of an array.

View 5 Replies View Related

Programming :: Shell Scripting Loop Error Yal2361: Command Not Found?

Jul 22, 2011

I have written the following script in my linux server to add users for LDAP database.But i can't able to run this.

The script is as following

#!/bin/bash
echo "Mention the username which you want to convert LDIF format"
read username
if ["$username" -e "/ldiffile/passwd"]; then
echo "Username already exists"
else
cat /etc/passwd | grep -i "$username" >> /ldiffile/passwd
fi
The output which i got :
. ldapadd.sh
Mention the username which you want to convert LDIF format
yal2361
-bash: [yal2361: command not found

please let me know where need to change and what

View 5 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 :: Perl About System Command / Fails If The Standard Shell Is Dash And Not Bash?

Jun 30, 2011

I am trying to fix a perl script, and I really suck at perl. But I think this problem will be easy for people who know it.

The problem is, I have an old setup script someone wrote many years ago. It fails if the standard shell is dash and not bash. The only way I've gotten it to work is to point /bin/sh to bash. I looked thru the script and it uses "system" many places, and I think that's the problem.

I searched for it and found this link:url

My plan is to include this function:

Code:
sub system_bash {
my @args = ( "bash", "-c", shift );
system(@args);
}
Then I could simply change all calls to system into system_bash and it should work?

The parameter to the system calls is usually some variable. What if the parameter is a list already? Do I need to test for it somehow, and if it's a list, prepend "bash" and "-c" to the list? How do I do that?

In the script there are lots of places like this:

my $error = system($cmd);
if ($error) {
die/warn "some error message";
}

Shouldn't there be a return in the system_bash function?

View 8 Replies View Related

Programming :: Bash Shell Read User Argument From Command Line And Test It

Aug 29, 2010

Trying to create a small script that will read user's input, test if user entered some input and if not display some message or display a text using user's input.

The script is the following but i get an error saying "[: 6: =: argument expected"

View 12 Replies View Related

Ubuntu :: Automatic OS Detection Won't Find It When Run The Mkconfig Command On Grub2's Wik

Dec 15, 2010

I changed the grub2 on my /dev/sda to Arch's version, instead of Ubuntu's, and now I keep booting into the initramfs prompt whenever I try to use Ubuntu. The automatic OS detection won't find it when I run the mkconfig command on grub2's wiki, and I currently have the following in /etc/grub.d/40_custom:

Code:

enuentry "Ubuntu Linux" {
set root=(hd0,3)
linux /boot/vmlinuz-2.6.35-23-generic
initrd /boot/initrd.img-2.6.35-23-generic root=dev/sda3 ro quiet
}

Which according to my partition layout, and a double check on gparted, is correct. Do I need to flag it as boot or something else? I tried putting Ubuntu's grub2 back on with the live cd but it kept saying /dev/ was busy.

View 9 Replies View Related

Programming :: Pattern Detection In The Logs + Notification?

Sep 6, 2010

I'm looking for a solution of pattern detection in the logs and then allows to send me an email notification if it detects the previously specified term.I use already Logwatch, but I do not know if it is possible to configure it for that use.

View 1 Replies View Related

Programming :: Hough Transforum Ellipse Detection?

Apr 12, 2010

I am trying to detect ellipse in an image through hough transformation. I am looking for sombody who can guide me the sequence of operation needed to perform and the accurate order of those operation.

View 1 Replies View Related

Programming :: OpenCV - Color Detection / Tracking

Oct 14, 2010

I've introduced myself to OpenCV a bit now and can do some of the most basic things with it. My current goal is to have a solid color object (say a red ball) and have a camera be able to find that object. Anybody know of any resources to start learning how to do this? Any tutorials/books? Or is there something I should be searching for instead of color detection and tracking that will give me things more in the right direction?

View 2 Replies View Related

Debian Programming :: Opcode Collision Detection Library

Mar 2, 2015

I would like to use the collision detection routine from the OPCODE library, newest version 1.3 ... There exist documentations, e.g. Opcode.pdf and OpcodeUserManual.pdf, but they do not agree with the source code, neither the current nor the previous version 1.2.

Any working example to check if to meshes collide? I only would like to define the meshes using triangles and connectivities (no callback function). I started with a code like the following, but not successfully.

#include <Opcode.h>
using namespace Opcode;
int main(void) {
IceMaths::IndexedTriangle *Tri0 = new IceMaths::IndexedTriangle[10];
IceMaths::Point *Pnt0 = new IceMaths::Point[10];
MeshInterface Mesh0;

[Code] ....

View 0 Replies View Related

Programming :: Bash Shell Scripting / Using The Sort Command To Sort The Top 5 CPU Processes?

Feb 28, 2010

What options should I use when I'm using the sort command to sort the top 5 CPU processes (ps -eo user,pid,ppid,%cpu,%mem,fname | sort ??? | head -5) showing max to min usage?

View 2 Replies View Related

Programming :: Effective Tool For Run Time Errors And Memory Leaks Detection

Dec 28, 2010

Created application is working too slow, looks like there are a lot of memory leaks, there are a lot of pointers. Any effective tool for run-time errors and memory leaks detection in Visual Studio C++?

View 2 Replies View Related

Programming :: Send A Run Program Command To Shell Thats Located In /home/user/myapp Using ./myapp From Irssi?

Mar 26, 2010

I am currently working to develop a perl script for irssi that will capture data from irc channel hold it in memory as variable and send it to a shell. Does anyone know a good irssi irc scripting guide? something that will include $botname, $msg, $nick, $channel etc scripting explanation. Is it possible to send a run program command to shell thats located in my /home/user/myapp using ./myapp from irssi? i am using bash. I've only just started, so i dont have any code written yet,

View 2 Replies View Related

Programming :: Shell Scripting / Create A Shell Script Similar To Ls?

Jun 5, 2011

I am trying to create a shell script similar to ls, but which only lists directories. I have the first half working (no argument version), but trying to make it accept an argument, I am failing. My logic is sound I think, but I'm missing something on the syntax.

Code:
if [ $# -eq 0 ] ; then
d=`pwd`
for i in * ; do
if test -d $d/$i ; then
echo "$i:"
code....

View 10 Replies View Related

Programming :: Bash-shell-like Less Functionality In The Python Shell?

Jun 25, 2010

Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?

Example:

Code:

>>> import subprocess
>>> help(subprocess)
...
[pages of stuff to read]
...

I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.

View 4 Replies View Related

Programming :: Prevent "leak" Into Shell From A Customized Shell Menu Script?

Dec 15, 2009

I've created a simple script based menu. This menu will be accessed by only a certain users via ssh.When user logs in, the menu will automatically run. (configured at user's .bash_profile).How do I force the session to close when user hits Ctrl-C or Ctrl-Break ?In a nutshell, I don't want user to have access to shell.

View 11 Replies View Related

Programming :: Shell Programming - Delete User Input

Jan 21, 2011

I recently started shell programming and my task now is to do a menu display.Currently i am stuck whereby user will input both title and author and it will delete it.

Do i have to use sed command?

View 4 Replies View Related







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