Search Results

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

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

  • SHAddToRecentDocs without a file?

    - by Chris Becke
    I was toying with an IRC client, integrating it with the windows 7 app bar. To get a "Frequent" or "Recent" items list one has to call SHAddToRecentDocs API. I want to add recent IRC channels visited to the Windows 7 Jumplist for the IRC application. Now, my problem is, IRC channels don't exist in the file system. And SHAddToRecentDocs seems to insist on getting some sort of file system object. Ive tried to work around it by creating a IShellItem pointing to my application, and giving it a command line to launch the channel. The shell is rebelling however, and thus far has not visibly added any of my "recent document" attempts to the Jumplist. Is there no way to do this without creating some kind of entirely unwanted filesystem object?

    Read the article

  • How do I get the name of the newest file via the Terminal?

    - by Alec
    I'm trying to create a macro for Keyboard Maestro for OS X doing the following: Get name of newest file in a directory on my disk based on date created; Paste the text "newest file: " plus the name of the newest file. One of its options is to "Execute a shell script", so I thought that would do it for 1. After Googling around a bit I came up with this: cd /path/to/directory/ ls -t | head -n1 This sorts it right, and returns the first filename. However, it also seems to includes a line break, which I do not want. As for 2: I can output the text "newest file: " with a different action in the app, and paste the filename behind that. But I'm wondering if you can't return "random text" + the outcome of the ls command. So my question is: can I do this only using the ls command? And how do I get just the name of the latest file without any linebreaks or returns?

    Read the article

  • filter to reverse lines of a text file

    - by Greg Hewgill
    I'm writing a small shell script that needs to reverse the lines of a text file. Is there a standard filter command to do this sort of thing? My specific application is that I'm getting a list of Git commit identifiers, and I want to process them in reverse order: git log --pretty=oneline work...master | grep -v DEBUG: | cut -d' ' -f1 | reverse The best I've come up with is to implement reverse like this: ... | cat -b | sort -rn | cut -f2- This uses cat to number every line, then sort to sort them in descending numeric order (which ends up reversing the whole file), then cut to remove the unneeded line number. The above works for my application, but may fail in the general case because cat -b only numbers nonblank lines. Is there a better, more general way to do this?

    Read the article

  • Saving current directory to zsh history

    - by user130208
    I wanted to achieve the same as asked here http://stackoverflow.com/questions/945288/saving-current-directory-to-bash-history but within zsh shell. I haven't done any zsh trickry before but so far I have: function precmd { hpwd=$history[$((HISTCMD-1))] if [[ $hpwd == "cd" ]]; then cwd=$OLDPWD else cwd=$PWD fi hpwd="${hpwd% ### *} ### $cwd" echo "$hpwd" ~/.hist_log } Right now I save the command annotated with the directory name to a log file. This works fine for me. Just thought there might be a way to make replacement in the history buffer itself.

    Read the article

  • killall httpd for sleep process

    - by user172697
    Hello guys this shell explain the issue , after executing the .sh file halt and nothing happen , any clue where is my mistake its kill httpd if there is more than 10 sleep process and start the httpd with zero sleep process #!/bin/bash #this means loop forever while [ 1 ]; do HTTP=`ps auwxf | grep httpd | grep -v grep | wc -l`; #the above line counts the number of httpd processes found running #and the following line says if there were less then 10 found running if [ $[HTTP] -lt 10 ]; then killall -9 httpd; #inside the if now, so there are less then 10, kill them all and wait 1 second sleep 1; #start apache /etc/init.d/httpd start; fi; #all done, sleep for ten seconds before we loop again sleep 10;done

    Read the article

  • Compatibility of x-www-browser

    - by rohit.arondekar
    I want to open html files from a shell script. I know that Ubuntu has a command x-www-browser that will open the default browser on the system. I also found via some Googling that the command is part of the debian system. I was wondering if the command is available on non debian based distros. If it isn't is there a standard way of opening an html file in the default browser on a linux OS via command line? Note that I'm using Bash.

    Read the article

  • Batch convert latin-1 files to utf-8 using iconv

    - by Jasmo
    I'm having this one PHP project on my OSX which is in latin1 -encoding. Now I need to convert files to UTF8. I'm not much a shell coder and I tried something I found from internet: mkdir new for a in ls -R *; do iconv -f iso-8859-1 -t utf-8 <"$a" new/"$a" ; done But that does not create the directory structure and it gives me heck load of errors when run. Can anyone come up with neat solution?

    Read the article

  • What would be the right way to declare an array within a script that will be called by cron?

    - by Nano Taboada
    I've written a Korn Shell script that sets an array the following way: set -A fruits Apple Orange Banana Strawberry but when I'm trying to run it from within cron, it raises the following error: Your "cron" job on myhost /myScript.sh produced the following output: myScript.sh: -A: bad option(s) I've tried many crontab syntax variants, such as: Attempt 1: 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /path/to/script/myScript.sh Attempt 2: 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /path/to/script/./myScript.sh Attempt 3: 0,5,10,15,20,25,30,35,40,45,50,55 * * * * cd /path/to/script && ./myScript.sh Any workaround would be sincerely appreciated. Thanks much in advance!

    Read the article

  • How do I send a file as an email attachment using Linux command line?

    - by Kit Roed
    I've created a script that runs every night on my Linux server that uses mysqldump to back up each of my MySQL databases to .sql files and packages them together as a compressed .tar file. The next step I want to accomplish is to send that tar file through email to a remote email server for safekeeping. I've been able to send the raw script in the body an email by piping the backup text file to mailx like so: $ cat mysqldbbackup.sql | mailx [email protected] cat echoes the backup file's text which is piped into the mailx program with the recipient's email address passed as an argument. While this accomplishes what I need, I think it could be one step better, Is there any way, using shell scripts or otherwise, to send the compressed .tar file to an outgoing email message as an attachment? This would beat having to deal with very long email messages which contain header data and often have word-wrapping issues etc.

    Read the article

  • How to write applications that modifies the Windows UI?

    - by StevenGilligan
    Hi, I have this programming question that's been bothering me for some time now. I'm wondering how is it possible to write applications that change the Windows UI? More precisely how could you write an application that modifies the Windows Taskbar or the Windows Desktop? I'm really interested in this topic but cannot find a lot of information. I've read about extending the Windows Shell but I can't seem to find anything related to modifying the Taskbar and the Desktop. I'm looking for something along the lines of Rainmeter. How did those guys create an application that lives inside the Windows Desktop? I'd like to point out that my prefered language for this would be C# but if you want to give me hints in other languages I'm fine with it and I am running on Windows 7. Thank you

    Read the article

  • How to get number of rows deleted from mysql in schell script

    - by simonlord
    Hi all I can't work out how to get the mysql client to return the number of rows deleted to the shell when running a delete. Does anyone know what option will enable this? Or ways around it? Here's what i'm trying, but i get no output: #!/bin/bash deleted=`mysql mydb -e "delete from mytable where insertedtime < '2010-04-01 00:00:00'"|tail -n 1` I was expecting something like this as the output from mysql: deleted 999999 Which is why i have the tail -n 1 so i only pick up the count and not the column name. Any help would be most appreciated.

    Read the article

  • cd Terminal at a given directory after running a Python script?

    - by Dave Everitt
    I'm working on a simple Python script that can use subprocess and/or os to execute some commands, which is working fine. However, when the script exits I'd like to cd the actual Terminal (in this case OS X) so on exit, the new files are ready to use in the directory where the have been created. All the following (subprocess.Popen, os.system, os.chdir) can do what I want from within the script (i.e. they execute stuff in the target directory) but on exit leave the Terminal at the script's own directory, not the target directory. I'd like to avoid writing a shell script to temporary file just to achieve this, if this is at all possible anyway?

    Read the article

  • Help with variables and new lines, and quoting in a bash script

    - by Scott
    I would like to automate the following svn command. Note this command produces the desired results on my system - Ubuntu 10.04, svn 1.6.6, bash shell, when issued from the command line: svn ci -m $'Added new File: newFile.txt\nOrig loc: /etc/networking/newFile.txt' /home/user/svnDir/newFile.txt I would like to run that command in a bash script, assuming that the original full path to the file is contained in the variable $oFileFull, and the filename is in $oFileName. The script is executed from the svn directory. I need to allow for the possibility that the file name and or path contain spaces. so the line inside my shel script might look like: svn ci -m$'Added new file: ${oFileName}\nOrig loc: ${oFileFull}' ${oFileName} But I want the variables (which may contain spaces) expanded before the command is executed, and I cannot figure out how to do this while enclosing the svn comment in single quotes which is necessary in order to get the new line in the subversion comment log. I am pulling my hair out trying to figure out how to properly quote and assemble this command. Any help appreciated.

    Read the article

  • VS 2008 and F# Feb CTP - Can't debug

    - by Steve
    I have downloaded the VS2008 integrated shell, and the F# Feb CTP and I have the F# environment working just fine. The problem comes when I try to debug. Nothing happens at all. The output window says ------ Build started: Project: ConsoleApplication1, Configuration: Debug Any CPU ------ ========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ========== and none of my breakpoints are hit. My "program" is as simple as can be #light open System printfn "Hello World" Console.ReadKey(true) with breakpoints on the printfn and Console lines. The things I've read seem to suggest that debugging would work with this setup, and there is a debugger folder under common7/packages with files in it. Thanks for any help. EDIT: I'm on Win7 64 bit

    Read the article

  • Awk appears to disconnect my DB2 session when piping

    - by greggannicott
    Hello. I'm attempting to run the following command in Korn Shell (ksh): set -A INDEXES `db2 "describe indexes for table ${TABSCHEMA}.${TABNAME} show detail" | awk '{print $1"."$2}'` What I'm attempting to achieve is place a list of the indexes over a particular table into an array which I can later iterate through. The problem is, when I run the above command the contents of the array starts with the error message of 'SQL1024N' (which is telling me that the database connection does not exist). However, if I remove the 'awk' at the end of the statement as so: set -A INDEXES `db2 "describe indexes for table ${TABSCHEMA}.${TABNAME} show detail"` it works just fine (well, to the extent its returning data. Obviously without the awk I'm not capturing the correct data). Does anyone know why the awk is having this affect? I appreciate there is more than one way to get this data, but it baffles me as to why this is happening. Thanks in advance. Greg.

    Read the article

  • How to create a zip file in the same format as the Finder's "Compress" menu item?

    - by benzado
    On Mac OS X, you can create a zip archive from the Finder by selecting some files and selecting "Compress" from the contextual menu or the File menu. Unfortunately, the resulting file is not identical to the archive created by the zip command (with the default options). This distinction matters to at least one service operated by Apple, which fails to accept archives created with the zip command. Having to create archives manually is preventing me from fully automating my release build process. How can I create a zip archive in the correct format within a shell script?

    Read the article

  • How can I (from a script) add something to the zsh command history?

    - by Brandon
    I'd like to be able to look through my command history and know the context from which I issued various commands--in other words, "what directory was I in?" There are various ways I could achieve this, but all of them (that I can think of) would require manipulating the zsh history to add (for instance) a commented line with the result of $(pwd). (I could create functions named cd & pushd & popd etc, or I could use zsh's preexec() function and maybe its periodic() function to add the comment line at most every X seconds, just before I issue a command, or perhaps there's some other way.) The problem is, I don't want to directly manipulate the history file and bypass the shell's history mechanism, but I can't figure out a way (with the fc command, for instance) to add something to the history without actually typing it on the command line. How could I do this?

    Read the article

  • Cygwin GCC + WinXP cmd.exe does nothing

    - by Stephen Friederichs
    My basic problem is that if I run GCC from the windows command line (cmd.exe in Windows XP) and it does nothing: no .o files are created, no error messages, nothing. It will only throw an error message if I use DOS-style paths, but nothing else. When I run from the Cygwin shell then it will throws error messages as appropriate for the errors in the source and produces the .o files as it needs. Using 'make' from the DOS command line doesn't work either. Has anyone encountered this behavior before?

    Read the article

  • How to know from a bash script if the user abruptly closes ssh session

    - by Figo
    I have a bash script that acts as the default shell for a user loging in trough ssh. It provides a menu with several options one of wich is sending a file using netcat. The netcat of the embedded linux I'm using lacks the -w option, so if the user closes the ssh connection without ever sending the file, the netcat command waits forever. I need to know if the user abruptly closes the connection so the script can kill the netcat command and exit gracefully. Things I've tried so far: Trapping the SIGHUP: it is not issued. The only signal issued i could find is SIGCONT, but I don't think it's reliable and portable. Playing with the -t option of the read command to detect a closed stdin: this would work if not for a silly bug in the embedded read command (only times out on the first invocation)

    Read the article

  • Shortest command to calculate the sum of a column of output on Unix?

    - by Andrew
    I'm sure there is a quick and easy way to calculate the sum of a column of values on Unix systems (using something like awk or xargs perhaps), but writing a shell script to parse the rows line by line is the only thing that comes to mind at the moment. For example, what's the simplest way to modify the command below to compute and display the total for the SEGSZ column (70300)? ipcs -mb | head -6 IPC status from /dev/kmem as of Mon Nov 17 08:58:17 2008 T ID KEY MODE OWNER GROUP SEGSZ Shared Memory: m 0 0x411c322e --rw-rw-rw- root root 348 m 1 0x4e0c0002 --rw-rw-rw- root root 61760 m 2 0x412013f5 --rw-rw-rw- root root 8192

    Read the article

  • Why can't I do this from ASP.NET?

    - by Nissan Fan
    The code below spawns the process and sits forever, never finishing. It doesn't matter what process I run. Also, if I use Shell with Wait it does the same thing. If I set wait to false in either approach it works just fine. It's ASP.NET 2.0 VB.NET DotNetNuke 4.0 on Windows Server 2003. I can't even phathom why this would hang up. From: http://www.freevbcode.com/ShowCode.asp?ID=5879 Public Sub ShellandWait(ByVal ProcessPath As String) Dim objProcess As System.Diagnostics.Process objProcess = New System.Diagnostics.Process() objProcess.StartInfo.FileName = ProcessPath objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal objProcess.Start() 'Wait until the process passes back an exit code objProcess.WaitForExit() 'Free resources associated with this process objProcess.Close() End Sub

    Read the article

  • What would be the simplest way to deal with a text file using JSP?

    - by Nano Taboada
    First and foremost I should acknowledge that I have no experience at all using Java ServerPages, but I'm positive about achieving this task if you guys help me out a bit since it doesn't seem like something difficult for a seasoned JSP programmer. Anyway the thing is, there's an actual running JSP application within a *NIX box which I somewhat administer with kind of good permissions. The idea is to create a new but dead simple JSP page to control some Korn Shell scripts I've got running there. So the goal is to make some sort of HTML form that will be writing some kind of scriptStatus.on / scriptStatus.off file: #!usr/bin/ksh # coolScript.sh # This is my cool script that is being launched by cron every 10 minutes. if [ -e scriptStatus.off ] then # monitor disabled else # monitor enabled fi which then can be checked for existence within the running script, therefore allowing to easily activate / deactivate it without actually have do deal with cron. Please let me know if all this does make any sense and don't hesitate to ask as much questions as needed. Thanks much in advance!

    Read the article

  • Interacts with dialog/whiptail on early boot rcX.d stage?

    - by nm
    Hi buddies, I'm developing on Ubuntu based, actually I got one script in-charged on GUI(console) setup. It runs before another scripts (rcX.d) start. Currently, I installed this script on rc2.d and start earlier than other ones. But when run on real machine, I can't input any keystroke on "dialog --inputbox" or whiptail through shell script. Additionally, It runs well on my Virtual Machine (Virtual Box and Vmware), that's so strange! So, does anybody give some help or point me any clues for overcome this ? Thanks

    Read the article

  • What environment variables available while starting the script using init.d boot process

    - by raj_arni
    My problem is like this (OS is Sun Solaris): 1) At the boot time I want to start a process using a specific script. I am doing this by putting this script in /etc/init.d (and following other K and S rules) 2) The program which will be called by the script is located at $HOME/xxx/yyy location. 4) I am using 'su - {myuser} -c "{full path of the program}"' in order to execute the script as {myuser} 3) I dont want to hardcode the value of $HOME in the script but want to use the $HOME env variable only. How can I get this $HOME env variable in the shell script? Also what other variables will be available to me?

    Read the article

  • What is linux equivalent of running a .bat file on windows from PHP using system()

    - by undefined
    I have a PHP script that runs a .bat file on my windows machine using $result = system("cmd /C nameOfBatchFile.bat"); This sets some environmental variables and is used to call Amazon EC2 API from the command line. How do I do the same from a Linux server? I have renamed my .bat file to a shell (.sh) and changed the script to use 'export' when setting env vars. I have tested by running the code from a putty terminal and it does what it should. So I know the commands in the script are good. How do I run this from PHP? I have tried running the same command as above with the new filename and I don't get any errors, or file not found etc but it doesn't appear to work. Where do I start trying to solve this?

    Read the article

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