shell

Using Django ORM outside of Django throws ImportError on assigning to the FK

When using the Django ORM from an external shell, using a model with a ForeignKey field an ImportError is thrown when assigning to it. And here is a paste of my shell sessions both from ./manage.py shell and from normal python shell. bradyrj@machine:~/workspaces/django/shellgame$ python manage.py shell Python 2.6.6 (r266:84292, Sep 15 ...

What is a unix command that will always return nothing no matter what parameters are given to it?

I want to put it at the top of a unix executable. right after the #! I know it seems silly, but I would like suggestions. ...

How come Windows still has such a lame command shell (and Mac has a normal one)?

Is there some reason that they've kept their same old lame shell? ...

helloworld.sh on x-wrt webif gives me a 403 unauthorized

Hello, I am trying to customize the webif v. 0.3-4895 package on openwrt-10.03.1-rc3 (backfire). I have a functional webif and I am trying to follow this wiki entry I copied info.sh to helloworld.sh and edited .categories and the ##WEBIF line but I dont see any change in the menu and when i call helloworld.sh I get a 403 on my browser....

How to make svn automatically detect delete's and move's of the file (shell, Ubuntu)

Hello! Вeing a happy user of git I now have to switch back to svn in one of the projects. I use it through the shell in Ubuntu and look for some command which may be similar to "git add ." - looking for all the files and folders being added, deleted or moved and making appropriate changes in the repository. Does it exist? It seems so s...

Yanking text from the previous stdout onto the command line.

I'd like to set up my Bash in such a way that I could yank text from the previous command's stdout. The example use case I'll use is resolving conflicts during a git rebase. $ git status # Not currently on any branch. # Unmerged paths: # (use "git reset HEAD <file>..." to unstage) # (use "git add/rm <file>..." as appropriate to mark...

unix shell code portable to run on all shells

H all, Hope all is well, Can any one please let me know the coding guidelines along with code samples of unix shell scripting by using which the code can run on most of the current shells like ksh, bash, csh etc. Most of the times some of my code written for ksh would not work on normal sh. I want to make my code maximum portable. Most...

How to grep directory for keyword existance?

For example I have a /path/to/folder and want to see if it contains "keyword1", "keyword2" or "keyword3" and the result would be (when 2 are found): /path/to/folder: keyword1 keyword3 I tried with options shown here but it doesn't work for folders. ...

How to use pastebin from shell script?

Is it possible to use pastebin (may be via their "API" functionality [http://www.pastebin.com/api.php] ) inside bash shell scripts? In detail i mean: how do i send http-post? And how do i get back the url? Thanks ahead ...

How to read output of sed into a variable.

I have variable which has value "abcd.txt". I want to store everything before the ".txt" in a second variable, replacing the ".txt" with ".log" I have no problem echoing the desired value: a="abcd.txt" echo $a | sed 's/.txt/.log/' But how do I get the value "abcd.log" into the second variable? Thanks, Roger ...

New Client needs help securing his website after getting hacked.. and I found this...

Soo, what is this? I haven't really experienced too much as far as "hacking" goes. I've dealt and solved most problems with PHP applications and I understand about 70% of this code. but here is what I found, a Web Shell.. by Boff? http://pastebin.com/kZeGHAHC ...

Help creating a simple C shell

Hello everyone, I am new to C and I am trying to create a simple C shell that will allow the user to perform various functions like chdir, cd, exit, mkdir. I've posted my code below. Can anyone look through it and see what I am doing wrong? I am not sure if I am using fork and execcv correctly. Thanks! include stdio.h include stdlib....

Using prolog to output into bash shell

Hi. I am trying to call a prolog program and receive output into my bash script. Currently I am using the extremely crude version of using halt(0) or halt(1) and then examining the exit code in bash, using 0 as true and 1 as false to the question my prolog program answers. Is there a better way to handle output? I am using gnu prolog. I...

Passing output from one command as argument to another

Hello, I have this for: for i in `ls -1 access.log*`; do tail $i |awk {'print $4'} |cut -d: -f 1 |grep - $i > $i.output; done ls will give access.log, access.log.1, access.log.2 etc. tail will give me the last line of each file, which looks like: 192.168.1.23 - - [08/Oct/2010:14:05:04 +0300] etc. etc. etc awk+cut will extract the dat...

shell script output to clipboard

is there any easy way to implement the copy to clipboard option from the output of a shell script ? ...

Cannot get a Cron event to fire on my Linux server.

I have a Amazon EC2 Linux micro instance server that I need to fire an hourly process on. I have chosen to use crontab and cannot get it to fire. I placed a *.sh file in the /etc/cron.hourly If I run $ sh /etc/cron.hourly/notify.sh the script behaves as expected. I have checked to see if the cron service is running and it is. I have...

Batch renaming files in unix and rollback

I rename few files (1234.xml, 9876.xml, 2345.xml etc) with .xml extension with the following code : for i in *.xml do mv $i $i.ab done it becomes 1234.xml.ab, 9876.xml.ab, 2345.xml.ab...etc Now, I want to rename it to 1234.xml.SD, 9876.xml.SD, 2345.xml.SD...etc. These are 100 files. How can this be achieved with the hel...

comparing two files using Shell script

hi, I have to compare two files which are like A B --- --- 110-01 110-01 120-02 110-02 ... 120-02 .... and have to print what are the extra elements present in the B file.. ...

How to ignore program's output when using /usr/bin/time ?

I want to know how long a program running, so I tried "/usr/bin/time ./program > /dev/null". But soon I found it displays program's output to stderr. I tried "/usr/bin/time ./program > /dev/null 2>&1" then, but /usr/bin/time's output not appear. So my question is, how to ignore program's output, and keep time's output. Thanks a lot. ...

Shell Script to download files

I am trying to write a unix shell script to download all the files in a directory posted on a website. How would I go about doing this? Thanks playas ...