fact()
{
if [ $1 -eq 1 ]
then
return 1
else
y=`expr $1 - 1`
fact $y
b=$(($1 * $?))
return $b
fi
}
echo "enter"
read n
fact $n
echo "$?"
this is a program to find the factorial of a number. output is correct up to 5 . the output of 6 is giving as 208 but the actual value is 720. w...
How do i run a shell command in asp.net ?
I basically want something like system("netstat -an");
I don't want the output to be displayed to the user. Just want to run some maintainence commands ...
...
hi,
i have 2 csv files on my windows machine that i want to transfer to a unix server every hour (because the 2 files are updated every 30min).
so i search on the web and i found this possibility: to ftp the files from windows to unix using a batch and task scheduler.
i want to know if it's possible to do it from the unix server with ...
I'm trying to test the result of a background shell process (ran with exec()). For this, I need the PHPUnit assertion to wait until the process ends.
I was wondering what is the best way to do this? Should I place the check for the running process in a loop, and use sleep() with a very small parameter to wait until it's finished?
...
I made the following script which searches for certain processes, displays uses pflags for each one, and stops when it finds one with the word "pause":
!cat find_pause
#!/usr/bin/perl -W
use warnings;
use strict;
if (open(WCF,
"ps -ef | grep '/transfile' | cut -c10-15 | xargs -n1 pflags 2>&1 |"
)) {
while (<WCF>) {
...
Can you edit a shell script while it's running and have the changes affect the running script?
I'm curious about the specific case of a csh script I have that batch runs a bunch of different build flavors and runs all night. If something occurs to me mid operation, I'd like to go in and add additional commands, or comment out un-execut...
Question: In command line, how do I call a python script with out having to type "python" before the script? is this even possible?
Info:
I wrote a handy script for accessing sqlite databases from command line, but I kind of don't like having to type "python SQLsap args" and would rather just type "SQLsap args". I don't know if this ...
I have asked how to make any command "ask for yes/no before executing" in the question
http://stackoverflow.com/questions/3231804/in-bash-how-to-add-are-you-sure-y-n-to-any-command-or-alias
It seems like for the command
hg push ssh://[email protected]//somepath/morepath
I can also do this:
echo ssh://[email protected]...
I want to have a cmd file with something like:
:one
start /wait (blabla1.exe -q -m 1>blabla1.log 2>&1)
:two
start /wait (blabla2.exe -q -m 1>blabla2.log 2>&1)
where I want the output of the blabla application not the output of the start command.
Is it even possible to have the redirections "local" inside the start command?
Do I...
I am trying write a shell script that will kill all processes that are running that match a certain pattern, then restart them. I can display the processes with:
ps -ef|grep ws_sched_600.sh|grep -v grep|sort -k 10
Which gives a list of the relevent processes:
user 2220258 1 0 16:53:12 - 0:01 /bin/ksh /../../../../../ws_...
Hi
I have the following shell script and want to change the filename db_backup.sql to be change so the current date is prepended to it e.g. yyyy-mm-dd-db_backup.sql
#!/bin/sh
mysqldump ... /_sql/db_backup.sql
gzip -f _sql/db_backup.sql
Simple question, hopefully quick and simple answer!
...
I'm trying to write a cron job that runs a report, and emails the result to an address defined in my user's ~/.bashrc file. I had this working perfectly on Fedora, but when I switched to Ubuntu, my solution no longer works. The command my cron job currently runs is:
. /home/myuser/.bashrc; /home/myuser/bin/runreport
If I run that comm...
linux & unix shells can process subcommands like this.
$> command `subcommand`
does windows cmd shell similar feature?
...
Hi everyone.
I seem to have discovered a problem with subprocess.Popen() on a Windows XP x64 machine. If Popen() is called with Shell=True, instead of a subprocess being created, the error
The syntax of the command is incorrect
is printed to the command prompt.
The problem was discovered when trying to use Mercurial on the comman...
Why is this such a bad idea? (According to many people)
...
My code:
#!/bin/sh
#filename:choose.sh
read choose
[ "$choose" == "y" -o "$choose" == "Y" ] && echo "Yes" && exit 0
[ "$choose" == "n" -o "$choose" == "N" ] && echo "No" && exit 0
echo "Wrong Input" && exit 0
But when I execute
sh ./choose.sh
terminal prompt me that
[: 4: n: :Unexpected operator
...
I am writing a short shell script which calls 'make all'. It's not critical, but is there a way I can suppress the message saying 'nothing to be done for all' if that is the case? I am hoping to find a flag for make which suppresses this (not sure there is one), but an additional line or 2 of code would work too.
FYI I'm using bash.
Ed...
Hi All,
My app contains documents in its database. The users can open the documents in which case, the document gets saved to a temporary folder and gets opened on the user's computer.
I'd like to get a notification when one of these temporary files are changed, and offer the user to save the changed document back to the database.
Wha...
Is there a way to run linux commands from javascript that uses a standalone interpreter (something similar with SpiderMonkey, JavaScript shell)?
...
Is it possible to use the IPython shell from an existing Python shell, as a shell-inside-a-shell, similarly to the built-in code.interact()?
...