Search Results

Search found 6936 results on 278 pages for 'shell scripting'.

Page 17/278 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Beginning with shell scripting

    - by Kevin Wyman
    I am fresh into Ubuntu and one of my goals is shell scripting for personal (and maybe public) use. I'm a novice, though I do understand some of the basics (e.g. what a variable, string, loop, etc... is) but to get the most of scripting I need to learn in-depth. I figure the best way to do that is to jump right into scripting and ask questions only pertinent to the stage I am at in my attempted script. Scenario: I have edited my sudoers file to allow my non-root user to run sudo commands without being prompted for a password. Question: In vim, what would be the best code to use for a function that checks whether this condition is [true], If not, prompt the user if they want the script to edit and save the sudoers file to make this condition [true]? Layout - If condition is true, carry-on with rest of script. If condition is not true, the script silently edits/adds the line: %sudo ALL=(ALL:ALL) NOPASSWD: ALL in the sudoers file, saves and then continues on with the next part of the script. Any help with this would be greatly appreciated and assist me in my journey to writing shell scripts.

    Read the article

  • No gnome shell after install on ubuntu 12.04 inside VMWare workstation

    - by Wouter
    I created a virtual machine for ubuntu 12.04. I then installed GNOME3 from the software center, How do I install and use the latest version of GNOME Shell?. However after install I don't get the new gnome shell, in the terminal gnome-shell --version tells me that I'm using the latest version, 3.4.1. My interface now looks like this: Does anybody have an idea why I do not get the latest gnome shell? @Histo yes but why I don't have this interface?

    Read the article

  • How do I disable the calendar events section in GNOME Shell's clock applet?

    - by Victor
    I'm running gnome-shell 3.2.0 and when I click the clock applet in the middle of the top panel, the following shows up: I have no need for the entire right part, right of the dotted line, which is dedicated to the "Online Accounts" integration with evolution's calendar. Is there a way to remove/disable it, so I can just have the date part of the calendar applet (left of the dotted vertical line)? I just like to browse the dates to see how many days are left in the month and stuff like that. I use Google's web interface for my "Calendaring".

    Read the article

  • Shell script to emulate warnings-as-errors?

    - by talkaboutquality
    Some compilers let you set warnings as errors, so that you'll never leave any compiler warnings behind, because if you do, the code won't build. This is a Good Thing. Unfortunately, some compilers don't have a flag for warnings-as-errors. I need to write a shell script or wrapper that provides the feature. Presumably it parses the compilation console output and returns failure if there were any compiler warnings (or errors), and success otherwise. "Failure" also means (I think) that object code should not be produced. What's the shortest, simplest UNIX/Linux shell script you can write that meets the explicit requirements above, as well as the following implicit requirements of otherwise behaving just like the compiler: - accepts all flags, options, arguments - supports redirection of stdout and stderr - produces object code and links as directed Key words: elegant, meets all requirements. Extra credit: easy to incorporate into a GNU make file. Thanks for your help. === Clues === This solution to a different problem, using shell functions (?), Append text to stderr redirects in bash, might figure in. Wonder how to invite litb's friend "who knows bash quite well" to address my question? === Answer status === Thanks to Charlie Martin for the short answer, but that, unfortunately, is what I started out with. A while back I used that, released it for office use, and, within a few hours, had its most severe drawback pointed out to me: it will PASS a compilation with no warnings, but only errors. That's really bad because then we're delivering object code that the compiler is sure won't work. The simple solution also doesn't meet the other requirements listed. Thanks to Adam Rosenfield for the shorthand, and Chris Dodd for introducing pipefail to the solution. Chris' answer looks closest, because I think the pipefail should ensure that if compilation actually fails on error, that we'll get failure as we should. Chris, does pipefail work in all shells? And have any ideas on the rest of the implicit requirements listed above?

    Read the article

  • how to implement word count bash shell

    - by codemax
    hey guys. I am trying to write my own code for the word count in bash shell. I did usual way. But i wanna use pipe's output to count the word. So for eg the 1st command is cat and i am redirecting to a file called med. Now i have to use to 'dup2' function to count the words in that file. How can i write the code for my wc? This is the code for my shell pgm : void process( char* cmd[], int arg_count ) { pid_t pid; pid = fork(); char path[81]; getcwd(path,81); strcat(path,"/"); strcat(path,cmd[0]); if(pid < 0) { cout << "Fork Failed" << endl; exit(-1); } else if( pid == 0 ) { int fd; fd =open("med", O_RDONLY); dup2(fd ,0); execvp( path, cmd ); } else { wait(NULL); } } And my wordcount is : int main(int argc, char *argv[]) { char ch; int count = 0; ifstream infile(argv[1]); while(!infile.eof()) { infile.get(ch); if(ch == ' ') { count++; } } return 0; } I dont know how to do input redirection i want my code to do this : When i just type wordcount in my shell implementation, I want it to count the words in the med file by default. Thanks in advance

    Read the article

  • Trying to use a grails domain class from the shell

    - by ?????
    I'm new to Grails. I'm trying to experiement with my grails domains from the shell, and I can't get it to work. These domains work fine from the scaffold code when I run the app. Given this domain class class IncomingCall { String caller_id Date call_time int call_length static constraints = { } } I try to create an "IncomingCall" and save it from the shell. No matter what I do, I always get "Null"; the object isn't created. And if I try to create the object and then do a save, I get the "No hibernate session bound to thread" error (see below). groovy:000> new IncomingCall(caller_id:'555-1212', call_time: new Date(), call_length:10).save() ERROR org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here at org.springframework.orm.hibernate3.SpringSessionContext.currentSession (SpringSessionContext.java:63) at org.hibernate.impl.SessionFactoryImpl.getCurrentSession (SessionFactoryImpl.java:574) at groovysh_evaluate.run (groovysh_evaluate:3) ... groovy:000> How can I make this work from the shell?

    Read the article

  • wscript.shell running file with space in path with PHP

    - by ermac2014
    I was trying to use wscript.shell through COM objects with php to pass some cmd commands to cURL library (the DOS version). here is what I use to perform this task: function windExec($cmd,$mode=''){ // Setup the command to run from "run" $cmdline = "cmd /C $cmd"; // set-up the output and mode if ($mode=='FG'){ $outputfile = uniqid(time()) . ".txt"; $cmdline .= " > $outputfile"; $m = true; } else $m = false; // Make a new instance of the COM object $WshShell = new COM("WScript.Shell"); // Make the command window but dont show it. $oExec = $WshShell->Run($cmdline, 0, $m); if ($outputfile){ // Read the tmp file. $retStr = file_get_contents($outputfile); // Delete the temp_file. unlink($outputfile); } else $retStr = ""; return $retStr; } now when I run this function like: windExec("\"C:/Documents and Settings/ermac/Desktop/my project/curl\" http://www.google.com/", 'FG'); curl doesn't run because there is a problem with the path. but when I remove the spaces from the path it works great. windExec("\"C:/curl\" http://www.google.com/", 'FG'); so my question is how can I escape these spaces in wscript.shell commands? is there anyway I can fix this? thanks in advance :)

    Read the article

  • Extract history from Korn shell

    - by Luc
    I am not happy about the history file in binary format of the Korn shell. I like to "collect" some of my command lines, many of them actually, and for a long time. I'm talking about years. That doesn't seem easy in Korn because the history file is not plain text so I can't edit it, and a lot of junk is piling up in it. By "junk" I mean lines that I don'twant to keep, like 'cat' or 'man'. So I added these lines to my .profile: fc -ln 1 9999 ~/khistory.txt source ~/loghistory.sh ~/khistory.txt loghistory.sh contains a handful of sed and sort commands that gets rid of a lot of the junk. But apparently it is forbidden to run fc in the .profile file. I can't login whenever I do, the shell exits right away with signal 11. So I removed that 'fc -l' line from my .profile file and added it to the loghistory.sh script, but the shell still crashes. I also tried this line in my .profile: strings ~/.sh_history ~/khistory.txt source ~/loghistory.sh That doesn't crash, but the output is printed with an additional, random character in the beginning of many lines. I can run 'fc -l' on the command line, but that's no good. I need to automate that. But how? How can I extract my ksh history as plain text? TIA

    Read the article

  • Run FFmpeg from Shell Script

    - by Abs
    Hello all, I have found a useful shell script that shows all files in a directory recursively. Where it prints the file name echo "$i"; #Display File name. I would instead like to run an ffmpeg command on non MP3 files, how can I do this? I have very limited knowledge of shell scripts so I appreciate if I was spoon fed! :) //if file is NOT MP3 ffmpeg -i [the_file] -sameq [same_file_name_with_mp3_extension] //delete old file Here is the shell script for reference. DIR="." function list_files() { if !(test -d "$1") then echo $1; return; fi cd "$1" echo; echo `pwd`:; #Display Directory name for i in * do if test -d "$i" #if dictionary then list_files "$i" #recursively list files cd .. else echo "$i"; #Display File name fi done } if [ $# -eq 0 ] then list_files . exit 0 fi for i in $* do DIR="$1" list_files "$DIR" shift 1 #To read next directory/file name done

    Read the article

  • finding the missing values in a range using any scripting language - perl, python or shell script

    - by manu
    Hi everyone I got stuck in one problem of finding the missing values in a range and the range is also variable for the successive rows. Ex. =================== inpt ==================== 673 673 673 676 676 680 2667 2667 2668 2670 2671 2674 ===================== output should be like this =================== 674 675 677 678 679 2669 2672 2673 ======================== This is just one part and the row values can be more also If there is any clarification plz let me know. thanx in advance manu

    Read the article

  • Blackberry development on scripting language ?

    - by zvr
    From what I've seen, the preferred way to develop Blackberry applications is Java. Is this the only way? I'm dreaming of a rapid application environment where you can create GUIs (using the Blackberry UI components). Something like a port of Tcl/Tk on Blackberry... or Python/Tkinter... or something new, but similar. Does something like that exist ? (I doubt it) Can something like that exist ? (i.e., given the money, is it feasible/reasonable/...)

    Read the article

  • FTP to SFTP in shell scripting

    - by Kimi
    This script is to connect to different servers and copy a file from a loaction defined. It is mandatory to use sftp and not ftp. #!/usr/bin/ksh -xvf Detail="jyotibo|snv4915|/tlmusr1/tlm/rt/jyotibo/JyotiBo/ jyotibo|snv4915|/tlmusr1/tlm/rt/jyotibo/JyotiBo/" password=Unix11! c_filename=import.log localpath1=`pwd` for i in $Detail do echo $i UserName=`echo $i | cut -d'|' -f1` echo $UserName remotehost=`echo $i | cut -d'|' -f2` echo $remotehost remote_path=`echo $i | cut -d'|' -f3` echo $remote_path { echo "open $remotehost user $UserName $password lcd $localpath1 cd $remote_path bi prompt mget $c_filename prompt " } |ftp -i -n -v 2>&1 done I want to do the similar thing using sftp instead of ftp.

    Read the article

  • bash/ksh/scripting eval subshell quotes

    - by jhon
    Hi tehere, I'm using ksh and have some little troubles, could you help me? why does not this code run? [root]$ CMD="ls -ltr" [root]$ eval "W=$( $CMD )" [root]$ ksh: ls -ltr: not found. [root]$ echo $W and this works fine: [root]$ CMD="ls -ltr" [root]$ eval 'W=$('$CMD')' [root]$ echo $W Thanks :-)

    Read the article

  • storing passed arguments in separate variables -shell scripting

    - by Nathan Pk
    In my script "script.sh" , I want to store 1st and 2nd argument to some variable and rest to another separate variable. What command I must use to implement this task? Number of arguments that is passed to a script is random) When I run the command in console ./script.sh abc def ghi jkl mn o p qrs xxx #It can have any number of arguments In this case, I want my script to store "abc" and "def" in one variable. "ghi jkl mn o p qrs xxx" should be stored in another variable.

    Read the article

  • Praat scripting

    - by Binaryrespawn
    Hi all, I am trying to write a praat script to do preprocessing on hundreds of speach samples. I need to extract speech features from each sample and feed these as imputs into a feed-forward neural network. I have already constructed the network using math-lab. However, learing to script in praat is proving to be quite a challenge given my time constraints. Some of my samples are 0.01 to 0.03 seconds in length, I was looking at standardising the duration for all samples using Pitch Synchronous OverLap-Add(PSOLA). However this will be very tedious if I were to do this for every sample. Is there any script that can read in all of my files and perform the operations in a batch mode? Any guidance will be surelly appreaciated. Regards.

    Read the article

  • Error when opening .tar.gz via Shell to install Apache Maven

    - by adamsquared
    Thank you in advance for the help. My Goal: To install apache maven per its websites instructions (http://maven.apache.org/download.html), in order to install the JUNG package according to its install instructions (http://sourceforge.net/apps/trac/jung/wiki/JUNGManual), so I can use the JUNG classes in various Java GUIs. The Problem: I get an error message when I try to extract the apache-maven .gz (install?) file in shell. Background: I'm trying to install the JUNG (http://jung.sourceforge.net/index.html) package to my system's Java, so I can write object-oriented code using various GUIs (Ecliplse, Dr. Java) using the classes in JUNG. I don't understand how the building/installing process works, and how I can get what I build/install to work on various GUIs and the command line. I'm new to shell and the command line, and mostly have experience using a simple IDE (DrJava, Python IDLE, R GUI) to write and compile object-oriented code. Machine: Mac OSX 10.5.8 32-bit. The Instructions: For the maven building Extract the distribution archive, i.e. apache-maven-3.0.4-bin.tar.gz to the directory you wish to install Maven 3.0.4. These instructions assume you chose /usr/local/apache-maven. The subdirectory apache-maven-3.0.4 will be created from the archive. ... for the JUNG installation Appendix: How to Build JUNG This is a brief intro to building JUNG jars with maven2 (the build system that JUNG currently uses). First, ensure that you have a JDK of at least version 1.5: JUNG 2.0+ requires Java 1.5+. Ensure that your JAVA_HOME variable is set to the location of the JDK. On a Windows platform, you may have a separate JRE (Java Runtime Environment) and JDK (Java Development Kit). The JRE has no capability to compile Java source files, so you must have a JDK installed. If your JAVA_HOME variable is set to the location of the JRE, and not the location of the JDK, you will be unable to compile. Get Maven Download and install maven2 from maven.apache.org: http://maven.apache.org/download.html At time of writing (early December 2009), the latest version was maven-2.2.1. Install the downloaded maven2 (there are installation instructions on the Maven website). Follow the installation instructions and confirm a successful installation by typing 'mvn --version' in a command terminal window. Get JUNG ... What I Did: I downloaded the file apache-maven-2.2.1-bin.tar.gz. The JUNG website specified to use apache maven 2. I wanted to stick to the recommended installation instructions, but I couldn't get to /usr on my GUI (i've noticed you click on the MacHD symbol on the desktop its missing several directories/folders that you can see using the shell using the ls command at root directory I couldn't find a way to access the file using my mac GUI. Therefore, I used the shell to navigate to the root directory and then to /usr/local, and used the mkdir command to make the directory apache-maven and entered it. I then moved the file using the mv command. Next I tried extracting the file using tar -zxvf apache-maven-2.2.1-bin.tar.gz. The Error Message: tar: apache-maven-2.2.1/direcoryandfile: Cannot open: No such file or directory ... apache-maven-2.2.1/lib/ext: Cannot mkdir: No such file or directory apache-maven-2.2.1/lib/ext/README.txt tar: apache-maven-2.2.1/lib/ext/README.txt: Cannot open: No such file or directory tar: Error exit delayed from previous errors From what I can tell the archive file is missing some directories or something. I tried deleting the file, redownloading the .tar.gz file from a different mirror and repeating the process. Same result. Thanks again for the help

    Read the article

  • Substring extraction using bash shell scripting and awk

    - by rohanbk
    So, I have a file called 'dummy' which contains the string: "There is 100% packet loss at node 1". I also have a small script that I want to use to grab the percentage from this file. The script is below. result=`grep 'packet loss' dummy` | awk '{ first=match($0,"[0-9]+%") last=match($0," packet loss") s=substr($0,first,last-first) print s}' echo $result I want the value of $result to basically be 100% in this case. But for some reason, it just prints out a blank string. Can anyone help me?

    Read the article

  • shell scripting: nested subshell ++

    - by jhon
    Hi guys, more than a problem, this is a request for "another way to do this" actually, if a want to use the result from a previous command I into another one, I use: R1=$("cat somefile | awk '{ print $1 }'" ) myScript -c $R1 -h123 then, a "better way"is: myScript -c $("cat somefile | awk '{ print $1 }'" ) -h123 but, what if I have to use several times the result, let's say: using several times $R1, well the 2 options: option 1 R1=$("cat somefile | awk '{ print $1}'") myScript -c $R1 -h123 -x$R1 option 2 myScript -c $("cat somefile | awk '{ print $1 }'" ) -h123 -x $("cat somefile | awk '{ print $1 }'" ) do you know another way to "store" the result of a previous command/script and use it as a argument into another command/script? thanks

    Read the article

  • patterns in case statement in bash scripting

    - by Ramiro Rela
    The man says that case statements use "filename expansion pattern matching". I usually want to have short names for some parameters, so I go: case $1 in req|reqs|requirements) TASK="Functional Requirements";; met|meet|meetings) TASK="Meetings with the client";; esac logTimeSpentIn "$TASK" I tried patterns like "req*" or "me{e,}t" which I understand would expand correctly to match those values in the context of filename expansion, but it doesn't work. Thanks.

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >