Search Results

Search found 6758 results on 271 pages for 'shell exec'.

Page 67/271 | < Previous Page | 63 64 65 66 67 68 69 70 71 72 73 74  | Next Page >

  • getting previously typed commands in python

    - by womble
    I'm using python 2.5 in windows on a macbook pro with IDLE. How do I get previously typed commands in the python shell? In other operating systems I've managed to do this using 'ctrl' + 'up arrow' or a similar combination. I've tried all likely combinations without success. Thanks.

    Read the article

  • How can I get awk input from a file and add my own text to the data?

    - by xs2dhillon
    Assume that I have a text file separated by colons. I understand how to display the entire text file or any specific column using awk. However, what I want to do is to get the awk output and then display it by adding my own text using a shell script? For example, assume that my text file is: England:London:GMT USA:Washington:EST France:Paris:GMT What I want to do is to display this input into the below format: COUNTRY: England CAPITOL: London TIMEZONE: GMT COUNTRY: USA CAPITOL: Washington TIMEZONE: EST COUNTRY: France CAPITOL: Paris TIMEZONE: GMT

    Read the article

  • Passing partial arguments in tcshell

    - by R S
    Hey, I'm writing a shell script (tcsh) that is supposed to received 3 parameters or more. The first 3 are to be passed to a program, and the rest are supposed to be passed to another program. All in all the script should look something like: ./first_program $1 $2 $3 ./second program [fourth or more] The problem is that I don't know how to do the latter - pass all parameters that are after the third.

    Read the article

  • Why does passing arguments to the command in an env invocation not work?

    - by timdisney
    I have a shell script to run node with some arguments like so: #!/usr/bin/env node --harmony_proxies ... This works fine under OS X but in Ubuntu it errors with: /usr/bin/env: node --harmony_proxies: No such file or directory Node is definitely installed and on the PATH since if I remove the --harmony_proxies flag it works fine. Is there some different way of passing arguments when using env in Ubuntu?

    Read the article

  • `export PS1='value'` does not propagate to (Korn) subshells for root?

    - by user319845
    Please consider the following /root/.profile: export PS1=value1 export x=value2 How come the login shell shows the expected prompt (and $x as value2), while the subshells keep showing $x as value2 but $PS1 as '#'? Just in case, I'm trying this under OpenBSD. [Yeah, I know... What on earth am I doing with OpenBSD if I don't know this? Just toying... in an isolated, most definitely non-production VM =).]

    Read the article

  • remove the content in directory and subdirectory hierarichally with out distroy the directory structure

    - by user3713876
    In shell script, I want to clear only text files and log files in the following structure with out removing the directory as well as subdirectories | |------bar/ | |---file1.txt |---file2.txt | |---subdir1/ | |---file1.log | |---file2.log | |---subdir2/ |---image1.log |---image2.log I am using rm -rf /bar/* so I am getting the result as follows. |------bar/ but I want the output like following | |------bar/ | | | | |---subdir1/ | | | |---subdir2/ I want to remove only text files or log files or csv with out removing the directory and the subdirectories

    Read the article

  • Problem executing bash file

    - by sandelius
    HI there! I've run into some problem while learning to combine .sh files and PHP. I've create a file test.sh and in that file I call a PHP file called test.php. If I double click on the .sh file then it runs perfectly but when I try to run it from the terminal I get "command not found". I'm in the exact folder as my .sh file but it wont work. Here's my test.sh: #!/bin/bash LIB=${0/%cli/} exec php -q ${LIB}test.php one two three exit; When I doubleclick on the test.sh file then it returns the argv array like it suppost to. But why can't I run it from terminal?

    Read the article

  • Data munging and data import scripting

    - by morpheous
    I need to write some scripts to carry out some tasks on my server (running Ubuntu server 8.04 TLS). The tasks are to be run periodically, so I will be running the scripts as cron jobs. I have divided the tasks into "group A" and "group B" - because (in my mind at least), they are a bit different. Task Group A import data from a file and possibly reformat it - by reformatting, I mean doing things like santizing the data, possibly normalizing it and or running calculations on 'columns' of the data Import the munged data into a database. For now, I am mostly using mySQL for the vast majority of imports - although some files will be imported into a sqlLite database. Note: The files will be mostly text files, although some of the files are in a binary format (my own proprietary format, written by a C++ application I developed). Task Group B Extract data from the database Perform calculations on the data and either insert or update tables in the database. My coding experience is is primarily as a C/C++ developer, although I have been using PHP as well for the last 2 years or so. I am from a windows background so I am still finding my feet in the linux environment. My question is this - I need to write scripts to perform the tasks I described above. Although I suppose I could write a few C++ applications to be used in the shell scripts, I think it may be better to write them in a scripting language (maybe this is a flawed assumption?). My thinking is that it would be easier to modify thins in a script - no need to rebuild etc for changes to functionality. Additionally, C++ data munging in C++ tends to involve more lines of code than "natural" scripting languages such as Perl, Python etc. Assuming that the majority of people on here agree that scripting is the way to go, herein lies my dilema. Which scripting language to use to perform the tasks above (giving my background). My gut instinct tells me that Perl (shudder) would be the most obvious choice for performing all of the above tasks. BUT (and that is a big BUT). The mere mention of Perl makes my toes curl, as I had a very, very bag experience with it a while back. The syntax seems quite unnatural to me - despite how many times I have tried to learn it - so if possible, I would really like to give it a miss. PHP (which I already know), also am not sure is a good candidate for scripting on the CLI (I have not seen many examples on how to do this etc - so I may be wrong). The last thing I must mention is that IF I have to learn a new language in order to do this, I cannot afford (time constraint) to spend more than a day, in learning the key commands/features required in order to do this (I can always learn the details of the language later, once I have actually deployed the scripts). So, which scripting language would you recommend (PHP, Python, Perl, [insert your favorite here]) - and most importantly WHY?. Or, should I just stick to writing little C++ applications that I call in a shell script?. Lastly, if you have suggested a scripting language, can you please show with a FEW lines (Perl mongers - I'm looking in your direction [nothing to cryptic!] ;) ) how I can use the language you suggested to do what I want to do. Hopefully, the lines you present will convince me that it can be done easily and elegantly in the language you suggested.

    Read the article

  • stream output of a command continuously run in php

    - by chandan kharbanda
    i am running this simple command { ./a.out < in; } & output.txt using exec and i want to output what's coming in output.txt through ajax request continuously. Also i want a way to turn off my output buffering.I tried flush() and ob functions but didn't succedded.In my /etc/php5/apache2/php.ini php.ini value of output_buffering = 4096.When I change it to Off and restart my apache2 server it fails to restart.P.S. I am using lamp server.

    Read the article

  • How to solve "java.io.IOException: error=12, Cannot allocate memory" calling Runtime#exec()?

    - by Andrea Francia
    On my system I can't run a simple Java application that start a process. I don't know how to solve. Could you give me some hints how to solve? The program is: [root@newton sisma-acquirer]# cat prova.java import java.io.IOException; public class prova { public static void main(String[] args) throws IOException { Runtime.getRuntime().exec("ls"); } } The result is: [root@newton sisma-acquirer]# javac prova.java && java -cp . prova Exception in thread "main" java.io.IOException: Cannot run program "ls": java.io.IOException: error=12, Cannot allocate memory at java.lang.ProcessBuilder.start(ProcessBuilder.java:474) at java.lang.Runtime.exec(Runtime.java:610) at java.lang.Runtime.exec(Runtime.java:448) at java.lang.Runtime.exec(Runtime.java:345) at prova.main(prova.java:6) Caused by: java.io.IOException: java.io.IOException: error=12, Cannot allocate memory at java.lang.UNIXProcess.<init>(UNIXProcess.java:164) at java.lang.ProcessImpl.start(ProcessImpl.java:81) at java.lang.ProcessBuilder.start(ProcessBuilder.java:467) ... 4 more Configuration of the system: [root@newton sisma-acquirer]# java -version java version "1.6.0_0" OpenJDK Runtime Environment (IcedTea6 1.5) (fedora-18.b16.fc10-i386) OpenJDK Client VM (build 14.0-b15, mixed mode) [root@newton sisma-acquirer]# cat /etc/fedora-release Fedora release 10 (Cambridge) EDIT: Solution This solves my problem, I don't know exactly why: echo 0 /proc/sys/vm/overcommit_memory Up-votes for who is able to explain :) Additional informations, top output: top - 13:35:38 up 40 min, 2 users, load average: 0.43, 0.19, 0.12 Tasks: 129 total, 1 running, 128 sleeping, 0 stopped, 0 zombie Cpu(s): 1.5%us, 0.5%sy, 0.0%ni, 94.8%id, 3.2%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 1033456k total, 587672k used, 445784k free, 51672k buffers Swap: 2031608k total, 0k used, 2031608k free, 188108k cached Additional informations, free output: [root@newton sisma-acquirer]# free total used free shared buffers cached Mem: 1033456 588548 444908 0 51704 188292 -/+ buffers/cache: 348552 684904 Swap: 2031608 0 2031608

    Read the article

  • SSH ForceCommand example - require a user to enter a token before getting shell access?

    - by consolibyte
    I'd like to prompt a user for some piece of information before they get to their BASH shell when they're logging in via SSH. Ideally, I'd like to execute a script which prompts them for information, check that the information is correct, and then if it is drop them to a shell. So, think: ssh [email protected] password: xxxx do you agree to the terms and conditions of use? enter yes or no: yes OK, here's your shell: # Can anyone provide an example of how to do something like this?

    Read the article

  • Is it possible to use rsync over sftp (without an ssh shell)?

    - by Tom Feiner
    Rsync over ssh, works great every time. However, trying to rsync to a host which allows only sftp logins, but not ssh logins, provides the following error: rsync -av /source ssh user@remotehost:/target/ protocol version mismatch -- is your shell clean? (see the rsync man page for an explanation) rsync error: protocol incompatibility (code 2) at compat.c(171) [sender=3.0.6] Here's the relevant section from the rsync man page: This message is usually caused by your startup scripts or remote shell facility producing unwanted garbage on the stream that rsync is using for its transport. The way to diagnose this problem is to run your remote shell like this: ssh remotehost /bin/true > out.dat then look at out.dat. If everything is working correctly then out.dat should be a zero length file. If you are getting the above error from rsync then you will probably find that out.dat contains some text or data. Look at the contents and try to work out what is producing it. The most com- mon cause is incorrectly configured shell startup scripts (such as .cshrc or .profile) that contain output statements for non-interactive logins. Trying this on my system produced the following in out.dat: ssh-dummy-shell: Command not allowed. As I thought, the host is not allowing ssh logins. The following link shows that it is possible to accomplish this task using fuse with sshfs - however it is extremely slow, and not fit for production use. Is there any chance of getting rsync sftp to work?

    Read the article

  • Is it possible to use rsync over sftp (without an ssh shell) ?

    - by Tom Feiner
    Rsync over ssh, works great every time. However, trying to rsync to a host which allows only sftp logins, but not ssh logins, provides the following error: rsync -av /source ssh user@remotehost:/target/ protocol version mismatch -- is your shell clean? (see the rsync man page for an explanation) rsync error: protocol incompatibility (code 2) at compat.c(171) [sender=3.0.6] Here's the relevant section from the rsync man page: This message is usually caused by your startup scripts or remote shell facility producing unwanted garbage on the stream that rsync is using for its transport. The way to diagnose this problem is to run your remote shell like this: ssh remotehost /bin/true > out.dat then look at out.dat. If everything is working correctly then out.dat should be a zero length file. If you are getting the above error from rsync then you will probably find that out.dat contains some text or data. Look at the contents and try to work out what is producing it. The most com- mon cause is incorrectly configured shell startup scripts (such as .cshrc or .profile) that contain output statements for non-interactive logins. Trying this on my system produced the following in out.dat: ssh-dummy-shell: Command not allowed. As I thought, the host is not allowing ssh logins. The following link shows that it is possible to accomplish this task using fuse with sshfs - however it is extremely slow, and not fit for production use. Is there any chance of getting rsync sftp to work?

    Read the article

  • How can I use '{}' to redirect the output of a command run through find's -exec option?

    - by pkaeding
    I am trying to automate an svnadmin dump command for a backup script, and I want to do something like this: find /var/svn/* \( ! -name dir -prune \) -type d -exec svnadmin dump {} > {}.svn \; This seems to work, in that it looks through each svn repository in /var/svn, and runs svnadmin dump on it. However, the second {} in the exec command doesn't get substituted for the name of the directory being processed. It basically just results a single file named {}.svn. I suspect that this is because the shell interprets > to end the find command, and it tries redirecting stdout from that command to the file named {}.svn. Any ideas?

    Read the article

  • How copy with shell commands(Linux) from 1 computer have (permanent url + open port) to 2 computer (secure way)?

    - by BenBen
    How copy with shell commands(Linux) from remote(my office computer) computer (permanent url + open port) to my (home) computer home/remote_computer_user/Desktop/test1.txt to my home computer home/home_computer_user/Downloads/ ? What I am doing: 1. ssh <user>@<computer1address> -p <port> :: success to get remote computer shell () 2. (I think I should use scp , but I dont how exactly in my case) Please if you can, write the exact commands that i should to from the shell Thanks in advance

    Read the article

  • Redirect output to file

    - by Algorist
    Hi, I have a shell script which is currently running and was running from past 8 hours. It will complete only by tomorrow evening. At the end of the program, it will print 2 million words to standard output. I am running the program on the screen. I forgot to redirect the output to a file. I know I won't be able to copy the data from the window. Is there a way to output the command to a file. I don't want to restart the program. Any thoughts?? Thank you. Bala

    Read the article

  • How prevalent is the use of Emacs' eshell in multi-platform development?

    - by pajato0
    I've only recently become aware of Emacs' eshell tool. It looks quite powerful in that it is entirely written in Emacs Lisp and does not require native subshell support. The Emacs info documentation is a bit sparse but EmacsWiki has pretty decent information, at least on a first glance. Given the potential value of eshell as a scripting tool/programmer's aid that works equally well on multiple platforms I'm wondering how prevalent the use of eshell versus the normal (bash) shell is among software developers. Would those of you who have taken the time to learn it recommend it or is it one of those many interesting ideas that did not really pan out?

    Read the article

  • Why is Standard Input is not displayed as I type in Mac OS X Terminal application?

    - by BryanWheelock
    I'm confused by some behavior of my Mac OS X Terminal and my Django manage.py shell and pdb. When I start a new terminal, the Standard Input is displayed as I type. However, if there is an error, suddenly Standard Input does not appear on the screen. This error continues until I shut down that terminal window. The Input is still being captured as I can see the Standard Output. E.g. in pdb.set_trace() I can 'l' to display where I'm at in the code. However, the 'l' will not be displayed, just an empty prompt. This makes it hard to debug because I can't determine what I'm typing in. What could be going wrong and what can I do to fix it?

    Read the article

  • comparing csv files

    - by Surresh2121
    I want to write a shell script to compare two .csv files. First one contains filename,path the second .csv file contains filename,paht,target. Now, I want to compare the two .csv files and output the target name where the file from the first .csv exists in the second .csv file. Ex. a.csv build.xml,/home/build/NUOP/project1 eesX.java,/home/build/adm/acl b.csv build.xml,/home/build/NUOP/project1,M1 eesX.java,/home/build/adm/acl,M2 ddexse3.htm,/home/class/adm/33eFg I want the output to be something like this. M1 and M2 Please help Thanks,

    Read the article

  • How do I prepare myself for a summer of working on Python using Linux environment?

    - by Shailesh Tainwala
    Hi, I have used just Windows for programming so far. Now, I have an internship starting in two weeks and I will be using just Linux environment with Python programming language. I've installed Ubuntu on my system but have no exposure to shell scripting. I need some advice on how I can quickly learn to use the Linux terminal quickly. Any books or web resources that you can suggest? Also, is there a particular IDE that is generally preferred for Python programming on Linux, or is Vim preferred? How can I best prepare myself for the internship ahead? Thanks for taking the time.

    Read the article

  • How netbeans installation file (bash file) contains Java code?

    - by Daziplqa
    Hi folks, I wonder, how a bash file can contain a Java code that is responsible about the installation of netbeans IDE which is as known is a Java based program? this is the case of netbeans: $ file netbeans-6.8-ml-java-linux.sh netbeans-6.8-ml-java-linux.sh: POSIX shell script text executable $ more netbeans-6.8-ml-java-linux.sh #!/bin/sh # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. # # Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. How this can happen?

    Read the article

  • Pipe implementation

    - by nunos
    I am trying to implement a linux shell that supports piping. I have already done simple commands, commands running in background, redirections, but piping is still missing. I have already read about it and seen some snippets of code, but still haven't been able to sort out a working solution. What I have so far: int fd[2]; pid_t pid = fork(); if (pid == -1) return -1; if (pid == 0) { dup2(0, fd[0]); execlp("sort", "sort", NULL); } I am a novice programmer, as you can probably tell, and when I am programming something I don't know much about, this being obviously the case, I like to start with something really easy and concrete and then build from there. So, before being able to implement three and more different commands in pipeline, I would like to be able to compute "ls names.txt | sort" or something similiar, in which names.txt is a file of names alfabetically unordered. Thanks.

    Read the article

  • sed/awk or other: increment a number by 1 keeping spacing characters

    - by WizardOfOdds
    I've got a string: (notice the spacing) eh oh 37 and I want it to become: eh oh 36 (so I want to keep the spacing) Using awk I don't find how to do it, so far I have: echo "eh oh 37" | awk '$3>=0&&$3<=99 {$3--} {print}' But this gives: eh oh 36 (the spacing characters where lost, because the field separator is ' ') Is there a way to ask awk something like "print the output using the exact same field separators as the input had"? Then I tried with sed, but got stuck after this: echo "eh oh 37" | sed -e 's/\([0-9][0-9]\)/.../' Can I do arithmetic from sed using a reference to the matching digits and have the output not modify the number of spacing characters? Note that it's related to my question concerning Emacs and how to apply this to some (big) Emacs region (using a replace region with Emacs's shell-command-on-region) but it's not an identical question: this one is specifically about how to "keep spaces" when working with awk/sed/etc.

    Read the article

< Previous Page | 63 64 65 66 67 68 69 70 71 72 73 74  | Next Page >