Search Results

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

Page 77/271 | < Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >

  • Is there a Scala version of .irbrc or another way to define some default libraries for REPL use?

    - by Tom Morris
    I've written a little library that uses implicits to add functionality that one only needs when using the REPL in Scala. Ruby has libraries like this - for things like pretty printing, firing up text editors (like the interactive_editor gem which invokes Vim from irb - see this post), debuggers and the like. The library I am trying to write adds some methods to java.lang.Class and java.lang.reflect classes using the 'pimp my library' implicit conversion process to help you go and find documentation (initially, with Google, then later possibly with a JavaDoc/ScalaDoc viewer, and maybe the StackOverflow API eventually!). It's an itch-scratching library: I spend so much time copying and pasting classnames into Google that I figured I may as well automate the process. It is the sort of functionality that developers will want to add to their system for use only in the REPL - they shouldn't really be adding it to projects (partly because it may not be something that their fellow developers want, but also because if you are doing some exploratory development, it may be with just a Scala REPL that's not being invoked by an IDE or build tool). In my case, I want to include a few classes and set up some implicits - include a .jar on the CLASSPATH and import it, basically. In Ruby, this is the sort of thing that you'd add to your .irbrc file. Other REPLs have similar ways of setting options and importing libraries. Is there a similar file or way of doing this for the Scala REPL?

    Read the article

  • Why does sh/bash set command line parameter values when trying to set environment variable?

    - by Touko
    A question on basics : While tuning environment variables for a program launched from a script, I ended up with somewhat strange behaviour with sh (which seems to be actually linked to bash) : variable setting seems to mess up with command-line parameters. Could somebody explain why does this happen? A simple script: #! /bin/sh # Messes with $1 ?? set ANT_OPTS=-Xmx512M export ANT_OPTS # Works # export ANT_OPTS=-Xmx512M echo "0 = $0" echo "1 = $1" When I run this with the upper alternative (set + export), the result is as following: $ ./test.sh foo 0 = ./test.sh 1 = ANT_OPTS=-Xmx512M But with lower alternative (export straight), the result is as I supposed: $ ./test.sh foo 0 = ./test.sh 1 = foo There is surely logical explanation, I just haven't figured it out yet. Somebody who does have idea? br, Touko

    Read the article

  • UNIX script to parse Zone file (is this the best code?)

    - by Steve
    Hi, FOund the following on: http://mike.murraynet.net/2009/08/23/parsing-the-verisign-zone-file-with-os-x/ Can unix-masters have a look at it and see if its the best possible way to gather the unique domainsnames in a zone file? For .NET domains: grep “^[a-zA-Z0-9-]+ NS .” net.zone|sed “s/NS .//”|uniq netdomains.txt For .COM domains: grep “^[a-zA-Z0-9-]+ NS .” com.zone|sed “s/NS .//”|uniq comdomains.txt For .EDU domains: grep “^[a-zA-Z0-9-]+ NS .” edu.zone|sed “s/NS .//”|uniq edudomains.txt

    Read the article

  • Bash script function return value problem

    - by Eedoh
    Hi to all. Can anyone help me return the correct value from a bash script function? Here's my function that should return first (and only) line of the file passed as an argument: LOG_FILE_CREATION_TIME() { return_value=`awk 'NR==1' $1` return return_value } And here's my call of that function in the other script: LOG_FILE_CREATION_TIME "logfile" timestamp=$? echo "Timestamp = $timestamp" I always get some random values with this code. If, for example, there's a value of 62772031 in the "logfile", I get Timestamp = 255 as an output. For some other values in the file, I get other random values as a return value, never the correct one. Any ideas?

    Read the article

  • how do I write a command-line interactive php script?

    - by user151841
    I want to write a php script that I can use from the command line. I want it to prompt and accept input for a few items, and then spit out some results. I want to do this in php, because all my classes and libraries are in php, and I just want to make a simple command line interface to a few things. The prompting and accepting repeated command line inputs is the part that's tripping me up. How do I do this?

    Read the article

  • recursively add file extension to all files

    - by seengee
    I have a few directories and sub-directories containing files with no file extension. I want to add .jpg to all the files contained within these directories. I have seen bash scripts for changing the file extension but not for just adding one. It also needs to be recursive, can someone help please?

    Read the article

  • ps: Clean way to only get parent processes?

    - by shkschneider
    I use ps ef and ps rf a lot. Here is a sample output for ps rf: PID TTY STAT TIME COMMAND 3476 pts/0 S 0:00 su ... 3477 pts/0 S 0:02 \_ bash 8062 pts/0 T 1:16 \_ emacs -nw ... 15733 pts/0 R+ 0:00 \_ ps xf 15237 ? S 0:00 uwsgi ... 15293 ? S 0:00 \_ uwsgi ... 15294 ? S 0:00 \_ uwsgi ... And today I needed to retrieve only the master process of uwsgi in a script (so I want only 15237 but not 15293 nor 15294). As of today, I tried some ps rf | grep -v ' \\_ '... but I would like a cleaner way. I also came accross another solution from unix.com's forums: ps xf | sed '1d' | while read pid tty stat time command ; do [ -n "$(echo $command | egrep '^uwsgi')" ] && echo $pid ; done But still a lot of pipes and ugly tricks. Is there really no ps option or cleaner tricks (maybe using awk) to accomplish that?

    Read the article

  • [bash] files indexed by production date

    - by caas
    Each day an application creates a file called file_YYYYMMDD.csv where YYYYMMDD is the production date. But sometimes the generation fails and no files are generated for a couple of days. I'd like an easy way in a bash or sh script to find the filename of the most recent file, which has been produced before a given reference date. Typical usage: find the last generated file, disregarding those produced after the May 1st. Thanks for your help

    Read the article

  • Calling a WPF Application and modify exposed properties?

    - by Justin
    I have a WPF Keyboard Application, it is developed in such a way that an application could call it and modify its properties to adapt the Keyboard to do what it needs to. Right now I have a file *.Keys.Set which tells the application (on open) to style itself according to that new style. I know this file could be passed as a command line argument into the application. That would not be a problem. My concern is, is there a way via a managed environment to change the properties of the executable as long as they are exposed properly, an example: 'Creates a new instance of the Keyboard Application Dim e_key as new WpfApplication("C:\egt\components\keyboard.exe") 'Sets the style path e_key.SetStylePath("c:\users\joe\apps\me\default.keys.set") e_key.Refresh() 'Applies the style e_key.HideMenu() 'Hides the menu e_key.ShowDeck("PIN") 'Shows the custom "deck" of keyboard keys the developer 'Created in the style application. ''work with events and response 'Clear the instance from memory e_key.close e_key.dispose e_key = nothing This would allow my application to become easily accessible to other Touch Screen Application Developers, allowing them to use my keyboard and keep the functionality they need. It seems like it might be possible because (name of executable).application shows all the exposed functions, properties, and values. I just have never done this before. Any help would be appreciated, thank you in advance.

    Read the article

  • Bash: Is it ok to use same input file as output of a piped command?

    - by Amro
    Consider something like: cat file | command > file Is this good practice? Could this overwrite the input file as the same time as we are reading it, or is it always read first in memory then piped to second command? Obviously I can use temp files as intermediary step, but I'm just wondering.. t=$(mktemp) cat file | command > ${t} && mv ${t} file

    Read the article

  • How to prevent filename expansion in for loop in bash

    - by cagri
    In a for loop like this, for i in `cat *.input`; do echo "$i" done if one of the input file contains entries like *a, it will, and give the filenames ending in 'a'. Is there a simple way of preventing this filename expansion? Because of use of multiple files, globbing (set -o noglob) is not a good option. I should also be able to filter the output of cat to escape special characters, but for i in `cat *.input | sed 's/*/\\*'` ... still causes *a to expand, while for i in `cat *.input | sed 's/*/\\\\*'` ... gives me \*a (including backslash). [ I guess this is a different question though ]

    Read the article

  • comparing two files and merge the data

    - by Ganz Ricanz
    I have the below files, total.txt order1,5,item1 order2,6,item2 order3,7,item3 order4,6,item4 order8,9,item8 changed.txt order3,8,item3 order8,12,item8 total.txt is total order data and changed.txt is recently changed data. I want to merge the recent change with total, i want the output as , Output.txt order1,5,item1 order2,6,item2 order3,8,item3 order4,6,item4 order8,12,item8 Note : 2nd column of (3rd & 5th) row of the total.txt is updated with changed.txt file i have used the below nawk to compare the first coulmn, but not able to print it to the output file. Please help on complete the below command nawk -F"," 'NR==FNR {a[$1]=$2;next} ($1 in a) "print??"' total.txt changed.txt

    Read the article

  • How can I quickly sum all numbers in a file?

    - by Mark Roberts
    I have a file which contains several thousand numbers, each on it's own line: 34 42 11 6 2 99 ... I'm looking to write a script which will print the sum of all numbers in the file. I've got a solution, but it's not very efficient. (It takes several minutes to run.) I'm looking for a more efficient solution. Any suggestions?

    Read the article

  • Use matching value of a RegExp to name the output file.

    - by fx42
    I have this file "file.txt" which I want to split into many smaller ones. Each line of the file has an id field which looks like "id:1" for a line belonging to id 1. For each id in the file, I like to create a file named idid.txt and put all lines that belong to this id in that file. My brute force bash script solution reads as follows. count=1 while [ $count -lt 19945 ] do cat file.txt | grep "id:$count " >> ./sets/id$count.txt count='expr $count + 1' done Now this is very inefficient as I have do read through the file about 20.000 times. Is there a way to do the same operation with only one pass through the file? - What I'm probably asking for is a way to use the value that matches for a regular expression to name the associated output file.

    Read the article

< Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >