Search Results

Search found 25651 results on 1027 pages for 'shell script'.

Page 5/1027 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Unix substr in shell script?

    - by KnockKnockWhosThere
    I have a string like sample.txt.pgp and I want to return sample.txt in a shell script. Is there a substr function? Like, if I did substr('sample.txt.pgp', -4, 0), is it supposed to return sample.txt? Right now it isn't, so I'm wondering if I have the syntax wrong, or maybe substr isn't a function?

    Read the article

  • Find maximum positive integer value in Bourne Shell

    - by l0b0
    I'm checking a counter in a loop to determine if it's larger than some maximum, if specified in an optional parameter. Since it's optional, I can either default the maximum to a special value or to the maximum possible integer. The first option would require an extra check at each iteration, so I'd like to instead find out what is the maximum integer that will work with the -gt Bourne Shell operation.

    Read the article

  • How to delay putting process in background until after it is ready to serve, in shell

    - by Jakub Narebski
    I have two processes: a server that should be run in background, but starts serving requests after a delay, and a client that should be started when server is ready. The server prints line containg "Acceptin connections" to its stderr when ready (server stderr is redirected to a file when running it in background). How to delay putting server process in background until server is ready to serve requests? Alternatively, how to delay running client until server is ready? Language: shell script (or optionally Perl).

    Read the article

  • Good book for learning Bourne shell?

    - by John Isaacks
    I want to learn how to write shell scripts. Particularly I want to write a svn post-commit script to upload files from a test server to a production server. I am sure I will want to write more as I get more into it. I have very little linux/unix knowledge. Can anyone recommend a good book?

    Read the article

  • Good book for learning Bash shell?

    - by John Isaacks
    I want to learn how to write shell scripts. Particularly I want to write a svn post-commit script to upload files from a test server to a production server. I am sure I will want to write more as I get more into it. I have very little linux/unix knowledge. Can anyone recommend a good book?

    Read the article

  • bash shell date parsing, start with specifc date and loop through each day in month

    - by Joe Stein
    Hi, I need to create a bash shell script starting with a day and then loop through each subsequent day formatting that output as %Y_%m_d I figure i can submit a start day and then another param for the number of days. My issue/question is how to set a DATE (that is not now) and then add a day. so my input would be 2010_04_01 6 my output would be 2010_04_01 2010_04_02 2010_04_03 2010_04_04 2010_04_05 2010_04_06 Thanks

    Read the article

  • ASP.NET Performance tip- Combine multiple script file into one request with script manager

    - by Jalpesh P. Vadgama
    We all need java script for our web application and we storing our JavaScript code in .js files. Now If we have more then .js file then our browser will create a new request for each .js file. Which is a little overhead in terms of performance. If you have very big enterprise application you will have so much over head for this. Asp.net Script Manager provides a feature to combine multiple JavaScript into one request but you must remember that this feature will be available only with .NET Framework 3.5 sp1 or higher versions.  Let’s take a simple example. I am having two javascript files Jscrip1.js and Jscript2.js both are having separate functions. //Jscript1.js function Task1() { alert('task1'); } Here is another one for another file. ////Jscript1.js function Task2() { alert('task2'); } Now I am adding script reference with script manager and using this function in my code like this. <form id="form1" runat="server"> <asp:ScriptManager ID="myScriptManager" runat="server" > <Scripts> <asp:ScriptReference Path="~/JScript1.js" /> <asp:ScriptReference Path="~/JScript2.js" /> </Scripts> </asp:ScriptManager> <script language="javascript" type="text/javascript"> Task1(); Task2(); </script> </form> Now Let’s test in Firefox with Lori plug-in which will show you how many request are made for this. Here is output of that. You can see 5 Requests are there. Now let’s do same thing in with ASP.NET Script Manager combined script feature. Like following <form id="form1" runat="server"> <asp:ScriptManager ID="myScriptManager" runat="server" > <CompositeScript> <Scripts> <asp:ScriptReference Path="~/JScript1.js" /> <asp:ScriptReference Path="~/JScript2.js" /> </Scripts> </CompositeScript> </asp:ScriptManager> <script language="javascript" type="text/javascript"> Task1(); Task2(); </script> </form> Now let’s run it and let’s see how many request are there like following. As you can see now we have only 4 request compare to 5 request earlier. So script manager combined multiple script into one request. So if you have lots of javascript files you can save your loading time with this with combining multiple script files into one request. Hope you liked it. Stay tuned for more!!!.. Happy programming.. Technorati Tags: ASP.NET,ScriptManager,Microsoft Ajax

    Read the article

  • shell script stopped working --- need to rewrite?

    - by OopsForgotMyOtherUserName
    The script below worked on my Mac OS X. I'm now using Ubuntu OS, and the script is no longer working. I'm wondering if there's something that I need to change here? I did change the first line from #!/bin/bash to #!/bin/sh, but it's still throwing up an error.... Essentially, I get an error when I try to run it: Syntax error: end of file unexpected (expecting ")") #!/bin/sh REMOTE='ftp.example.com' USER='USERNAME' PASSWORD='PASSWORD' CMDFILE='/jtmp/rc.ftp' FTPLOG='/jtmp/ftplog' PATTERN='SampFile*' date > $FTPLOG rm $CMDFILE 2>/dev/null LISTING=$(ftp -in $REMOTE <<EOF user $USER $PASSWORD cd download ls $PATTERN quit EOF ) echo "open $REMOTE" >> $CMDFILE echo "user $USER $PASSWORD" >> $CMDFILE echo "verbose" >> $CMDFILE echo "bin" >> $CMDFILE echo "cd download" >> $CMDFILE for FILE in $LISTING do echo "get $FILE" >> $CMDFILE done echo "quit" >> $CMDFILE ftp -in < $CMDFILE >> $FTPLOG 2>&1 rm $CMDFILE

    Read the article

  • What does /dev/null mean in the shell?

    - by rishiag
    I've started learning bash scripting by using this guide: http://www.tldp.org/LDP/abs/abs-guide.pdf However I got stuck at the first script: cd /var/log cat /dev/null > messages cat /dev/null > wtmp echo "Log files cleaned up." What do lines 2 and 3 do in Ubuntu (I understand cat)? Is it only for other Linux distributions? After running this script as root, the output I get is Log files cleaned up. But /var/log still contains all the files.

    Read the article

  • Stop execution of python script when parent Bash shell script is killed

    - by jrdioko
    I'm working on a Bash shell script that runs several Python scripts like so: cd ${SCRIPT_PATH} python -u ${SCRIPT_NAME} ${SCRIPT_ARGS} >> $JOBLOG 2>&1 At one point, I killed the shell script (using kill PID), but the Python script continued running, even after the script terminated. I thought these would die as soon as the main script died. What am I misunderstanding about Bash scripting, and what can I do to get the functionality I'm looking for? Thanks in advance!

    Read the article

  • Create database in Shell Script - convert from PHP

    - by snaken
    I have the following PHP code that i use to create a databaase and grant permissions to a user: $con = mysql_connect("IP.ADDRESS","user","pass"); mysql_query("CREATE DATABASE ".$dbuser."",$con)or die(mysql_error()); mysql_query("grant all on ".$dbuser.".* to ".$dbname." identified by '".$dbpass."'",$con) or die(mysql_error()); I want to perform these same actions but from within a shell script. Is it just something like this: MyUSER="user" MyPASS="pass" MYSQL -u $MyUSER -h -p$MyPASS -Bse "CREATE DATABASE $dbuser;' MYSQL -u $MyUSER -h -p$MyPASS -Bse "GRANT ALL ON ${DBUSER}.* to $DBNAME identified by $DBPASS;"

    Read the article

  • Shell script for testing

    - by Helltone
    I want a simple testing shell script that launches a program N times in parallel, and saves each different output to a different file. I have made a start that launches the program in parallel and saves the output, but how can I keep only the outputs that are different? Also how can I actually make the echo DONE! indicate the end? #!/bin/bash N=10 for((i=1; j<=$N; ++i)); do ./test > output-$N & done echo DONE!

    Read the article

  • Shell script to count files, then remove oldest files

    - by Nic Hubbard
    I am new to shell scripting, so I need some help here. I have a directory that fills up with backups. If I have more than 10 backup files, I would like to remove the oldest files, so that the 10 newest backup files are the only ones that are left. So far, I know how to count the files, which seems easy enough, but how do I then remove the oldest files, if the count is over 10? if [ls /backups | wc -l > 10] then echo "More than 10" fi

    Read the article

  • Shell script to copy files

    - by Hulk
    If there exist a directory, /backup/ And the files in it are a.gz b.gz c.gz And another directory /backup-directorybackup And the files in it are a.gz I need a shells script to compare two directories if the files are present then ignore it and if the filesare not present copy it to the destination directory Thanks..

    Read the article

  • Cannot install gnome shell extensions

    - by gnome
    I upgrade from 10.04 to 12.04, install gnome 3 and remove unity. My gnome version is 3.4.1. The GNOME Shell extensions is installed and enabled. When I use firefox to visit each extension page in https://extensions.gnome.org/, for example, https://extensions.gnome.org/extension/5/alternative-status-menu/, there is no where to install the extensions. I am told that one can install extensions by visite these extension pages. This is the guide I followed.

    Read the article

  • Launching "Script of the Day" - Learn an amazing IT script sample every 24 hours

    - by Jialiang
    Every day is an opportunity to learn something or discover something new.  Learn one IT script sample every day; Be an IT master in a year! Microsoft All-In-One Script Framework offers "Script of the Day".  "Script of the Day" introduces one amazing script sample every 24 hours that demonstrates the frequently asked IT tasks.  If you are curious about and passionate for learning something new, follow the "Script of the Day” RSS feed or visit the "Script of the Day" homepage, and share your feedback with us [email protected].     Subscribe to the RSS Feed: http://blogs.technet.com/b/onescript/rss.aspx?tags=ScriptOfTheDay

    Read the article

  • Simple script - execute command on selected file

    - by askmoo
    I want to make a script that will execute .jar file on selected file. Later I will add that script to right-click menu via the tool Nautilus Actions or just place it into nautilus-scripts folder. I have a problem creating script. When I am in a usual console screen and want to execute this jar file on any other file, I use this syntax myfile.jar ./someotherfile.xml and the jar file will write the output to the console screen. So I created a file script.sh, added lines in it #!/bin/bash /home/username/myfile.jar $1 But it does not output anything. I know I am doing something wrong. Please help. To sum, I need a script that will use selected file as a parameter, open the gnome-terminal, inside that terminal it will start JAR file and pass it the selected file. I am confident that this is a very simple procedure, but I am total newbie with shell scripting.

    Read the article

  • shell script output in html + email that html

    - by Kimi
    Using Solaris I have a monitoring script that uses other scripts as plugins. Theses pugins are also scripts which work in difffernt ways like: 1. Sending an alert while high memory uilization 2. High Cpu usage 3. Full disk Space 4. chekcking the core file dump Now all this is dispalyed on my terminal and I want to put them in a HTML file/format and send it as a body of the mail not as attachment. Thanks .

    Read the article

  • Korn Shell - Test with variable that may be not set

    - by C. Ross
    I have the following code in KornShell FAILURE=1 SUCCESS=0 isNumeric(){ if [ -n "$1" ]; then case $1 in *[!0-9]* | "") return $FAILURE; * ) return $SUCCESS; esac; else return $FAILURE; fi; } #... FILE_EXT=${FILE#*.} if [ isNumeric ${FILE_EXT} ]; then echo "Numbered file." fi #... In some cases the file name not have an extension, and this causes the FILE_EXT variable to be empty, which causes the following error: ./script[37]: test: 0403-004 Specify a parameter with this command. How should I be calling this function so that I do not get this error?

    Read the article

  • execute script after desktop loaded?

    - by Andre
    I want to execute bash script on startup that opens several terminals in different workspaces. Script works just fine if I call it from terminal, but it doesn't work if executed from crontab using @reboot: #!/usr/bin/env bash #1 make sure we have enough workspaces gconftool-2 --set -t int /apps/metacity/general/num_workspaces 7 #2. Launch programs in these terminals wmctrl -s 6 gnome-terminal --full-screen --execute bash -c "tmux attach; bash" wmctrl -s 5 gnome-terminal --full-screen --execute bash -c "weechat-curses; bash" wmctrl -s 4 gnome-terminal --full-screen --execute bash -c "export TERM=xterm-256color; mutt; bash" wmctrl -s 3 gnome-terminal --full-screen wmctrl -s 2 gnome-terminal --full-screen wmctrl -s 1 gnome-terminal --full-screen wmctrl -s 0 google-chrome --start-maximized I think it's because crontab job triggers before desktop environment is loaded...maybe...? How can I execute this script after desktop environment is loaded? thanks:) Update 1: i've started it from crontab initially like this: @reboot $HOME/andreiscripts/startup.sh >> $HOME/andreiscripts/testlog.txt 2>&1 and was getting these errors: Cannot open display. Failed to parse arguments: Cannot open display: Cannot open display. Failed to parse arguments: Cannot open display: Cannot open display. ..... Update 2 I've tried to launch script from System Preferences Startup Applications /home/andrei/andreiscripts/startup.sh >> /home/andrei/Desktop/out.txt 2>&1 but script only opened first gnome-terminal in workspace 6... and wouldn't continue executing the rest of the script until I close that gnome-terminal and so on....

    Read the article

  • Shell script task status monitoring

    - by Bikram Agarwal
    I'm running an ANT task in background and checking in 60 second intervals whether that task is complete or not. If it is not, every 60 seconds, a message should be displayed on screen - "Deploy process is still running. $slept seconds since deploy started", where $slept is 60, 120, 180 n so on. There's a limit of 1200 seconds, after which the script will show the log via 'ant log' command and ask the user whether to continue. If the user chooses to continue, 300 seconds are added to the time limit and the process repeats. The code that I am using for this task is - ant deploy & limit=1200 deploy_check() { while [ ${slept:-0} -le $limit ]; do sleep 60 && slept=`expr ${slept:-0} + 60` if [ $$ = "`ps -o ppid= -p $!`" ]; then echo "Deploy process is still running. $slept seconds since deploy started." else wait $! && echo "Application ${New_App_Name} deployed successfully" || echo "Deployment of ${New_App_Name} failed" break fi done } deploy_check if [ $$ = "`ps -o ppid= -p $!`" ]; then echo "Deploy process did not finish in $slept seconds. Here's the log." ant log echo "Do you want to kill the process? Press Ctrl+C to kill. Press Enter to continue." read log limit=`expr ${limit} + 300` deploy_check fi Now, the problem is - this code is not working. This looks like a perfectly good code and yet, this is not working. Can anyone point out what is wrong with this code, please.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >