Search Results

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

Page 70/271 | < Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >

  • OpenSSL "Seal" in C (or via shell)

    - by chpwn
    I'm working on porting some PHP code to C, that contacts a web API. The issue I've come across is that the PHP code uses the function openssl_seal(), but I can't seem to find any way to do the same thing in C or even via openssl in a call to system(). From the PHP manual on openssl_seal(): int openssl_seal ( string $data , string &$sealed_data , array &$env_keys , array $pub_key_ids ) openssl_seal() seals (encrypts) data by using RC4 with a randomly generated secret key. The key is encrypted with each of the public keys associated with the identifiers in pub_key_ids and each encrypted key is returned in env_keys . This means that one can send sealed data to multiple recipients (provided one has obtained their public keys). Each recipient must receive both the sealed data and the envelope key that was encrypted with the recipient's public key. What would be the best way to implement this? I'd really prefer not to call out to a PHP script every time, for obvious reasons.

    Read the article

  • Bourne Shell: Convert ~/Desktop to /users/me/Desktop

    - by sixtyfootersdude
    Incredably annoyed at the Java Keytool. So much so that I have created a new tag: "SunSuck". The keytool does not resolve impartial directories. Ie this works: keytool -keystore "/users/me/Desktop" ... This doesn't: keytool -keystore "~/Desktop" ... Is there something that I could call like this: keytool -keystore "$(<cmd> ~/Desktop)" ...

    Read the article

  • ATL OR C# for windows shell/namespace extenssion?

    - by _Avishay_
    Hi, i have a question, after allot of hours in googling and reading articles, i understood that namespace extenssion in windows is quite tricky (In C++ at least), now i've also seen its possible to do so in C# , but microsft does'nt officaly confirms using .net for namespace extensions... though i have seen very nice commercial Namespace Extenssion framework , but none is free.... so to my question :) , i want to develop my own Namespace Extenssion ,i have C++/C# knwoledge and basic COM/ATL , but if it can be done i prefer c#, so does c# inteop can fully do the work without too many tricks ? or one shall go diving in the ATL to create the neccessary COM objects... and another question , can i program to Windows O/S with C# anything that can be done in C++/ATL/MFC ? thanks!

    Read the article

  • Only some windows shell commands work via ruby?

    - by Sanarothe
    Hi. I'm trying to use a script to control my power options since XP doesn't give you an intuitive way to change CPU Frequency options. Here's my script so far: meh = `cmd.exe /C POWERCFG.EXE /QUERY Portable/Laptop` puts "" puts meh case input when 1 then system('cmd.exe /C POWERCFG.EXE /CHANGE Portable/Laptop /processor-throttle-ac NONE') when 2 then system('cmd.exe /C POWERCFG.EXE /CHANGE Portable/Laptop /processor-throttle-ac ADAPTIVE') when 3 then `cmd.exe /C POWERCFG.EXE /CHANGE Portable/Laptop /processor-throttle-ac CONSTANT` end The problem is that the changes simply don't take place. If I run the same commands directly into a cmd.exe prompt, they work. It's very strange, but nothing works after the initial powercfg query. I feel like I'm missing something incredibly obvious. How can I get the above script to run correctly?

    Read the article

  • Bash script "read" not pausing for user input when executed from SSH shell

    - by Aaron Hancock
    I'm new to Bash scripting, so please be gentle. I'm connected to a Ubuntu server via SSH (PuTTY) and when I run this command, I expect the bash script that downloads and executes to allow user input and then echo that input. It seems to just write out the echo label for the input request and terminate. wget -O - https://raw.github.com/aaronhancock/pub/master/bash/readtest.sh | bash Any clue what I might be doing wrong? UPDATE: This bash command does exactly what I wanted bash <(wget -q -O - https://raw.github.com/aaronhancock/pub/master/bash/readtest.sh)

    Read the article

  • Redirect PHP-Shell-Script output

    - by Corelgott
    Hi Folks, i have got a php-script foo.php #!/usr/bin/php -c /etc/php5/cli/php.ini -q <?php echo 'hello'; // & do some stuff ?> I call this script not wrapped by a sh-script but using it directly in a cron job. To get rid of it's output i normally would just create a sh-file which calls /usr/bin/php -c /etc/php5/cli/php.ini -q foo.php > /dev/null 2 > /dev/null now i'd like to do this in the interpreter-declaration of the php file it self... so i am looking for the syntax for: #!/usr/bin/php -args [file's content] > /redirect 2 > /redirect i have kind of a hard time googleing for it... so if anybody could point me into the right direction i would really appreciate it! Thx in advance Corelgott

    Read the article

  • Invoking external shell application through RubyCocoa

    - by Shyam
    Hi, How would I invoke an external application through the RubyCocoa bridge? I read something about NSTask, yet I have no idea how this should be translated in RubyCocoa. My goal is to have an IB_action to trigger a method which will run a terminal application with some parameters, i.e. ls -p $mydir, where mydir comes from an IB_outlet such as an Textfield. Any directions or help would be greatly appreciated!

    Read the article

  • Shell loops using non-integers?

    - by mary
    I wrote a .sh file to compile and run a few programs for a homework assignment. I have a "for" loop in the script, but it won't work unless I use only integers: #!/bin/bash for (( i=10; i<=100000; i+=100)) do ./hw3_2_2 $i done The variable $i is an input for the program hw3_2_2, and I have non-integer values I'd like to use. How could I loop through running the code with a list of decimal numbers?

    Read the article

  • Popen is no able to process a command that runs in shell

    - by IceMan85
    Hello everybody, I have already read the previous questions posted on the same argument but I really haven't figured it out yet. I am trying to run a command that works without issues from the command line : xyz@klm:~/python-remoteWorkspace/PyLogParser/src:18:43ush -o PPP -p PRD -n log 'pwd' 6:43PM PPP:prd:lgsprdppp:/ama/log/PRD/ppp but when I do the same in python I always get errors : stringa = Popen(["ush -o PPP -p PRD -n log 'pwd'"], stdout=PIPE, stdin=PIPE).communicate()[0] Here the error. Traceback (most recent call last): File "getStatData.py", line 134, in retrieveListOfFiles(infoToRetList) File "getStatData.py", line 120, in retrieveListOfFiles stringa = Popen(["ush -o PPP -p PRD -n log 'pwd'"], stdout=PIPE, stdin=PIPE).communicate()[0] File "/opt/python-2.6-64/lib/python2.6/subprocess.py", line 595, in init errread, errwrite) File "/opt/python-2.6-64/lib/python2.6/subprocess.py", line 1092, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory I've tried also different solutions like stringa = Popen(["ush", "-o", "PPP", "-p" "PRD", "-n", "log", '"pwd"'], stdout=PIPE, stdin=PIPE).communicate()[0] but nothing seems to work. I have also tried to put the absolute path to ush but nothing... Can somebody please explain me what am I doing wrong ? Thanks in advance, AM.

    Read the article

  • URL protocol handler shell execute problem

    - by Chuck
    Hi, I'm working on a small hobby web site where I'm able to launch a local app with certain arguments based on links. Setting up a protocol wasn't difficult, as described in http://msdn.microsoft.com/en-us/library/aa767914(VS.85).aspx, but I have one dilemma: Let's say the protocol is: foo:127.0.0.1:1111, so a link like href="foo:127.0.0.1:1111" would launch an app like: bar.exe "%1". Since I don't have any control over bar.exe (if I had, then it would be no problem to just parse it, obviously), I need some help parsing %1. bar.exe will launch correctly if it's run as bar.exe 127.0.0.1:1111, but not if it's run as bar.exe foo:127.0.0.1:1111. So I guess my question is... is there ANY way to tell the registry to pass on not %1, but a trimmed %1? (Thinking in terms of regexp where you have match[0] = all of the matched, match[1] = first capture in the matched text). I can solve it by having a .bat instead of .exe, but as I would like to make it as easy as possible for the user to use, I would LOVE it if I could handle it all stricly in registry. Any help is greatly appreciated! Chuck

    Read the article

  • $where in mongodb web shell not working

    - by Bravo
    i have the below set of test documents which i inserted in to the mongodb and when i use to query the db using the $where get the below exception Error: database error: $where query, but no script engine Any idea why the $where clause not working test data : db.things.save({ "_id" : 1, "domainName" : "test11.com", "hosting" : "hostgator.com" }) db.things.save({ "_id" : 2, "domainName" : "test2.com", "hosting" : "aws.amazon.com"}) db.things.save({ "_id" : 3, "domainName" : "test3.com", "hosting" : "aws.amazon.com" }) db.things.save({ "_id" : 4, "domainName" : "test4.com", "hosting" : "hostgator.com" }) db.things.save({ "_id" : 5, "domainName" : "test5.com", "hosting" : "aws.amazon.com" }) db.things.save({ "_id" : 6, "domainName" : "test6.com", "hosting" : "cloud.google.com" }) db.things.save({ "_id" : 7, "domainName" : "test7.com", "hosting" : "aws.amazon.com" }) db.things.save({ "_id" : 8, "domainName" : "test8.com", "hosting" : "hostgator.com" }) db.things.save({ "_id" : 9, "domainName" : "test9.com", "hosting" : "cloud.google.com" }) db.things.save({ "_id" : 10, "domainName" : "test10.com", "hosting" : "godaddy.com" }) query used : db.things.find( { $where: "this.domainName == 'test11.com'" } );

    Read the article

  • Incremental deploy from a shell script

    - by WishCow
    I have a project, where I'm forced to use ftp as a means of deploying the files to the live server. I'm developing on linux, so I hacked together a bash script that makes a backup of the ftp server's contents, deletes all the files on the ftp, and uploads all the fresh files from the mercurial repository. (and taking care of user uploaded files and folders, and making post-deploy changes, etc) It's working well, but the project is starting to get big enough to make the deployment process too long. I'd like to modify the script to look up which files have changed, and only deploy the modified files. (the backup is fine atm as it is) I'm using mercurial as a VCS, so my idea is to somehow request the changed files between two revisions from it, iterate over the changed files, and upload each modified file, and delete each removed file. I can use hg log -vr rev1:rev2, and from the output, I can carve out the changed files with grep/sed/etc. Two problems: I have heard the horror stories that parsing the output of ls leads to insanity, so my guess is that the same applies to here, if I try to parse the output of hg log, the variables will undergo word-splitting, and all kinds of transformations. hg log doesn't tell me a file is modified/added/deleted. Differentiating between modified and deleted files would be the least. So, what would be the correct way to do this? I'm using yafc as an ftp client, in case it's needed, but willing to switch.

    Read the article

  • help with using alias in bash shell

    - by ajsie
    i want to have an alias "t" to enter a folder and list the content there. i tried with: alias t="cd $1; ls -la" but it just listed the folder i typed but did not enter it. i wonder why? cause when i use this one: alias b="cd ..; ls" it went back to the parent and listed the content. so i want the "t" do enter the folder i type in too. someone knows how to do this right?

    Read the article

  • Fork to shell script and terminate original process with Haskell

    - by Neth
    I am currently writing a Haskell program that does some initialization work and then calls ncmpcpp. What I am trying to do is start ncmpcpp and terminate the Haskell program, so that only ncmpcpp is left (optionally, the program can keep running in the background, as long as it's unintrusive) However, even though I am able to start ncmpcpp, I cannot interact with it. I see its output, but input appears to be impossible. What I am currently doing is: import System.Process (createProcess, proc) ... spawnCurses :: [String] -> IO () spawnCurses params = do _ <- createProcess (proc "ncmpcpp" params) return () What am I doing wrong/What should I do differently?

    Read the article

  • How to access the calling source line from interactive shell

    - by TJD
    I want to make a function that can determine the source code of how it was called. I'm aware of how to do this generally with the inspect module. For example, this question, works well and provides my desired output in the lines variable as shown below: def hello(x): frame,filename,line_number,function_name,lines,index=\ inspect.getouterframes(inspect.currentframe())[1] print(frame,filename,line_number,function_name,lines,index) The problem is that this solution doesn't work in an interactive command line session. For example, from a command line, the result looks like: >>> y = hello(7) (<frame object at 0x01ECA9E8>, '<stdin>', 1, '<module>', None, None) The problem is that the source file is '<stdin>', so the lines variable is None. How can I access the calling line to find the result containing the string y = hello(7) during an interactive session?

    Read the article

  • errors on shell

    - by lego69
    somebody knows what does this error mean? Usage: tcsh [ -bcdefilmnqstvVxX ] [ argument ... ]. I receive this error after I enter in my script this row #! /bin/tcsh -f

    Read the article

  • grep --exclude/--include syntax (do not grep through certain files)

    - by Piskvor
    I'm looking for the string "foo=" (without quotes) in text files in a directory tree. It's on a common Linux machine, I have bash shell: grep -ircl "foo=" * In the directories are also many binary files which match "foo=". As these results are not relevant and slow down the search, I want grep to skip searching these files (mostly JPEG and PNG images): how would I do that? I know there are the --exclude=PATTERN and --include=PATTERN options, but what is the pattern format? manpage of grep says: --include=PATTERN Recurse in directories only searching file matching PATTERN. --exclude=PATTERN Recurse in directories skip file matching PATTERN. Searching on grep include, grep include exclude, grep exclude and variants did not find anything relevant If there's a better way of grepping only in certain files, I'm all for it; moving the offending files is not an option, I can't search only certain directories (the directory structure is a big mess, with everything everywhere). Also, I can't install anything, so I have to do with common tools (like grep or the suggested find). UPDATES: @Adam Rosenfield's answer is just what I was looking for: grep -ircl --exclude=*.{png,jpg} "foo=" * @rmeador's answer is also a good solution: grep -Ir --exclude="*\.svn*" "pattern" * It searches recursively, ignores binary files, and doesn't look inside Subversion hidden folders.(...)

    Read the article

  • curl POST to RESTful services

    - by Sashikiran Challa
    Hello All, There are a lot of questions on Stackoverflow about curl but I could not figure out what is that I am doing what I am not supposed to. I am trying to call a RESTful service that I had written using Jersey API and am trying to POST an xml string to it and I get HTTP 415 error which is supposed to be a Media Type error. Here in my shell script call to 1st service: abc=curl http://gf...:8080/InChItoD/inchi/3dstructure?InChIstring=$inchi echo $abc (this works fine the output that it returns is given below.) Posting this xml string to second service def= curl -d $abc -H "Content-Type:text/xml" http://gf...:8080/XML2G/xml3d/gssinput I get the following error: ... ... HTTP Status 415 Status report message description.The server refused this request because the request entity is in a format not supported by the requested resource for the requested method ().Apache Tomcat/6.0.26 This is a sample of xml string I am trying to POST <?xml version="1.0"?><molecule xmlns="http://www.xml-cml.org/schema"> <atomArray> <atom id="a1" elementType="N" formalCharge="1" x3="0.997963" y3="-0.002882" z3="-0.004222"/> <atom id="a2" elementType="H" x3="2.024650" y3="-0.002674" z3="0.004172"/> <atom id="a3" elementType="H" x3="0.655444" y3="0.964985" z3="0.004172"/> <atom id="a4" elementType="H" x3="0.649003" y3="-0.496650" z3="0.825505"/> <atom id="a5" elementType="H" x3="0.662767" y3="-0.477173" z3="-0.850949"/> </atomArray> <bondArray> <bond atomRefs2="a1 a2" order="1"/> <bond atomRefs2="a1 a3" order="1"/> <bond atomRefs2="a1 a4" order="1"/> <bond atomRefs2="a1 a5" order="1"/> </bondArray></molecule> Thanks in advance

    Read the article

  • sed/awk or other: one-liner to increment a number by 1 keeping spacing characters

    - by WizardOfOdds
    EDIT: I don't know in advance at which "column" my digits are going to be and I'd like to have a one-liner. Apparently sed doesn't do arithmetic, so maybe a one-liner solution based on awk? 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 yet something else, using awk's sub(..,..) method: ' sub(/[0-9][0-9]/, ...) {print}' but no cigar yet: I don't know how to reference the regexp and do arithmetic on it in the second argument (which I left with '...' for now). 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

  • I trying to backreference using the sed command

    - by Paul
    I am relative new to shell scripting and sed. I need to substitute a pattern, globably, but I also need to remember (or save) part of the pattern and use it later in the same substitute command. The saved pattern will be varible, so I need to use a wild card. For example, input message=trt:GetAudioSourcesRequest/> and I want to end up with something like input message=trt:GetAudioSourcesRequest PAUL/GetAudioSourcesRequest/> but the function string "GetAudioSourcesRequest" will change (in length also) throughtout the file, so I need a wild card, e.g. sed -i "s/input message=trt:<wild card in here>/>/input message=trt:<print wild card> PAUL/<print wild card>/> I have managed to get the following command to nearly do what I want but it is too rigid. It only stores a 4 syllable pattern so if I have a function name such as GetProfileRequest, this doesn't work echo "input message=\"trt:GetAudioSourcesRequest\"/>" | sed 's/input message=\"trt:\([A-Z][a-z]*\)\([A-Z][a-z]*\)\([A-Z][a-z]*\)\([A-Z][a-z]*\).*/input message=\"trt:\1\2\3\4\ PAUL\/\1\2\3\4"\/\>/g' This outputs input message="trt:GetAudioSourcesRequest PAUL/GetAudioSourcesRequest"/> Which is ok but when I use GetProfileRequest this doesn't. I have come accross \W and [^[:alnum:]] or [[:alnum:]] but I don't how to use them Thanks in advance.

    Read the article

  • use awk to identify multi-line record and filtering

    - by nanshi
    I need to process a big data file that contains multi-line records, example input: 1 Name Dan 1 Title Professor 1 Address aaa street 1 City xxx city 1 State yyy 1 Phone 123-456-7890 2 Name Luke 2 Title Professor 2 Address bbb street 2 City xxx city 3 Name Tom 3 Title Associate Professor 3 Like Golf 4 Name 4 Title Trainer 4 Likes Running Note that the first integer field is unique and really identifies a whole record. So in the above input I really have 4 records although I dont know how many lines of attributes each records may have. I need to: - identify valid record (must have "Name" and "Title" field) - output the available attributes for each valid record, say "Name", "Title", "Address" are needed fields. Example output: 1 Name Dan 1 Title Professor 1 Address aaa street 2 Name Luke 2 Title Professor 2 Address bbb street 3 Name Tom 3 Title Associate Professor So in the output file, record 4 is removed since it doen't have the "Name" field. Record 3 doesn't have Address field but still being print to the output since it is a valid record that has "Name" and "Title". Can I do this with awk? But how do i identify a whole record using the first "id" field on each line? Thanks a lot to the unix shell script expert for helping me out! :)

    Read the article

  • How to replace pairs of strings in two files to identical IDs?

    - by Péter Török
    Sorry if the title is not very intelligible, I couldn't come up with anything better. Hopefully my explanation is clear enough: I have a pair of rather large log files with very similar content, except that some strings are different between the two. A couple of examples: UnifiedClassLoader3@19518cc | UnifiedClassLoader3@d0357a JBossRMIClassLoader@13c2d7f | JBossRMIClassLoader@191777e That is, wherever the first file contains UnifiedClassLoader3@19518cc, the second contains UnifiedClassLoader3@d0357a, and so on. [Update] There are about 40 distinct pairs of such identifiers.[/Update] I want to replace these with identical IDs so that I can spot the really important differences between the two files. I.e. I want to replace all occurrences of both UnifiedClassLoader3@19518cc in file1 and UnifiedClassLoader3@d0357a in file2 with UnifiedClassLoader3@1; all occurrences of both JBossRMIClassLoader@13c2d7f in file1 and JBossRMIClassLoader@191777e in file2 with JBossRMIClassLoader@2 etc. Using the Cygwin shell, so far I managed to list all different identifiers occurring in one of the files with grep -o -e 'ClassLoader[0-9]*@[0-9a-f][0-9a-f]*' file1.log | sort | uniq However, now the original order is lost, so I don't know which is the pair of which ID in the other file. With grep -n I can get the line number, so the sort would preserve the order of appearance, but then I can't weed out the duplicate occurrences. Unfortunately grep can not print only the first match of a pattern. I figured I could save the list of identifiers produced by the above command into a file, then iterate over the patterns in the file with grep -n | head -n 1, concatenate the results and sort them again. The result would be something like 2 ClassLoader3@19518cc 137 ClassLoader@13c2d7f 563 ClassLoader3@1267649 ... Then I could (either manually or with sed itself) massage this into a sed command like sed -e 's/ClassLoader3@19518cc/ClassLoader3@2/g' -e 's/ClassLoader@13c2d7f/ClassLoader@137/g' -e 's/ClassLoader3@1267649/ClassLoader3@563/g' file1.log > file1_processed.log and similarly for file2. However, before I start, I would like to verify that my plan is the simplest possible working solution to this. Is there any flaw in this approach? Is there a simpler way?

    Read the article

  • Run command with space characters in bash script

    - by ??iu
    I have a file that contains a list of files: 02 of Clubs.eps 02 of Diamonds.eps 02 of Hearts.eps 02 of Spades.eps ... I am attempting to mass-convert these to png format in several sizes. The script I am using to do this is: while read -r line do for i in 80 35 200 do convert $(sed 's/ /\\ /g' <<< Cards/${line}) -size ${i}x${i} ../img/card/$(basename $(tr ' ' '_' <<< ${line} | tr '[A-Z]' '[a-z]') .eps)_${i}.png; done done < card_list.txt However, this doesn't work, apparently trying to split on each word, resulting in the following error output: convert: unable to open image `Cards/02\': No such file or directory @ error/blob.c/OpenBlob/2514. convert: no decode delegate for this image format `Cards/02\' @ error/constitute.c/ReadImage/532. convert: unable to open image `of\': No such file or directory @ error/blob.c/OpenBlob/2514. convert: no decode delegate for this image format `of\' @ error/constitute.c/ReadImage/532. convert: unable to open image `Clubs.eps': No such file or directory @ error/blob.c/OpenBlob/2514. If I change the convert to an echo the result looks right and if I copy a line and run it myself in the shell it works fine: convert Cards/02\ of\ Clubs.eps -size 80x80 ../img/card/02_of_clubs_80.png convert Cards/02\ of\ Clubs.eps -size 35x35 ../img/card/02_of_clubs_35.png convert Cards/02\ of\ Clubs.eps -size 200x200 ../img/card/02_of_clubs_200.png convert Cards/02\ of\ Diamonds.eps -size 80x80 ../img/card/02_of_diamonds_80.png convert Cards/02\ of\ Diamonds.eps -size 35x35 ../img/card/02_of_diamonds_35.png convert Cards/02\ of\ Diamonds.eps -size 200x200 ../img/card/02_of_diamonds_200.png convert Cards/02\ of\ Hearts.eps -size 80x80 ../img/card/02_of_hearts_80.png convert Cards/02\ of\ Hearts.eps -size 35x35 ../img/card/02_of_hearts_35.png convert Cards/02\ of\ Hearts.eps -size 200x200 ../img/card/02_of_hearts_200.png convert Cards/02\ of\ Spades.eps -size 80x80 ../img/card/02_of_spades_80.png UPDATE: Just adding quotes (see below) has the same result as the above, where I had been using sed to add backslashes convert '"'Cards/${line}'"' -size ${i}x${i} ../img/card/$(basename $(tr ' ' '_' <<< ${line} | tr '[A-Z]' '[a-z]') .eps)_${i}.png; I've tried both double and single quotes

    Read the article

< Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >