Using the top command with redirection works fine:
top > top.log
Now I want to use grep to filter a certain line:
top | grep "my_program" > top.log
But the log file will remain empty. But grep delivers an output when using
top | grep "my_program"
Where my_program has to be replaced by a running program to see some output.
Why does my approach not work ? And how can I fix it ?
I am trying to created aliases for tcsh from a python script (running Python 2.7.1).
Once the aliases are created I want to use them in the same shell I ran the python script in.
I tried:
os.system('alias test "echo test"')
but I get the following error:
sh: line 0: alias: test: not found
sh: line 0: alias: echo test: not found
I then tried:
os.system(r"""/bin/csh -i -c 'alias test "echo t
I have two scripts: "autorun.py" and "main.py". I added "autorun.py" as service to the autorun in my linux system. works perfectly!
Now my question is: When I want to launch "main.py" from my autorun script, and "main.py" will run forever, "autorun.py" never terminates as well!
Hello out there, I got this script that runs partly fine by my crontab. Problem is it gets to the sleep 300(which should be 5 minutes right?) part and never runs the rest of the scripts past that. All individual scripts run just fine.
I have to repeat following operation a lot of times, hence I want to automate it.
sudo su
tcsh
cd $workDir
Here $workDir is set in ~/.tcshrc. I tried writing two shells scripts. Script1 is temp.sh
#!/bin/bash
sudo su
./temp.csh
Script2 is temp.csh
#!/usr/bin/tcsh
tcsh
cd $workDir
But it doesn't work as expected. Any help / pointers?
Hi everyone. I've been reading around and am a little bit overwhelmed, hoping to find a kind soul out there to hold my hand through writing my first script. This need has emerged at work and I haven't much experience writing shell scripts, but this is a problem we have with a production environment and I am tasked with providing the solution.
I'm probably doing something remarkably stupid, but I can't figure out what.
Running Ubuntu Server 12.04 on a cloud host (Digital Ocean, if it matters).
Hi
I have created a function in a Shell Script test.sh
Code:
function fnTest()
{
echo "My first Method
}
I have called this function in my test.sh
Code:
cat abc.txt | grep "test"
echo " test"
fnTest
But while running the shell script i got the following error:
./test.sh: line 5: fnTest: command not found
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1.