Search Results

Search found 4958 results on 199 pages for 'shell'.

Page 29/199 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • Determine if a directory is empty, delete it if it is and delete that directroy name from a separate list. C-shell

    - by Kg123
    I have a directory named STA. Within that directory are about 600 other directories that have the format hh:mm:ss (for example 00:01:34). Within each of these sub-directories should be three files. I also have a file, 'waveformlist', (contained within STA) which is a list of all of these sub-directories i.e.: 00:01:34 00:02:35 etc. A lot of the sub-directories do not contain these three files and are instead empty. I want to run a C-shell script to go through every sub directory and check if it is empty. If it is empty I want to delete that sub directory from the main directory STA, and also remove that sub-directory name from the list 'waveformlist'. Below is my script so far. It does not recognize when the sub-directory is empty or not and does not like the rm $dir line. Also, I do not know how to go and remove the sub-directory name from 'waveformlist'. #!/bin/csh echo "Enter name of station folder to apply filter to as 'STA' e.g. APZ:" set ans = $< cd $ans set c=0 foreach dir (*:*) if ("${c}" == 0) then echo "Empty directory:" $dir rm $dir else echo ${dir} "has files" endif end I hope I have been clear enough. Thank you.

    Read the article

  • What is common between environments within a shell terminal session?

    - by Matt1776
    I have a custom shell script that runs each time a user logs in or identity is assumed, its been placed in /etc/profile.d and performs some basic env variable operations. Recently I added some code so that if screen is running it will reattach it without needing me to type anything. There are some problems however. If I log-in as root, and su - to another user, the code runs a second time. Is there a variable I can set when the code runs the first time that will prevent a second run of the code? I thought to write something to the disk but then I dont want to prevent the code from running if I begin a new terminal session. Here is the code in question. It first attempts to reattach - if unsuccessful because its already attached (as it might be on an interruped session) it will 'take' the session back. screen -r if [ -z "$STY" ]; then exec screen -dR fi Ultimately this bug prevents me from substituting user to another user because as soon as I do so, it grabs the screen session and puts me right back where I started. Pretty frustrating

    Read the article

  • TAB completion not working in ubuntu hardy heron

    - by Tutul
    I have recently installed ubuntu hardy and found that shell command completion with TAB doesn't work, the package 'bash-completion' is installed in my system. I guess it is related to dash being the default shell? Is there a way to use tab completion in dash? If there isn't a way then how can i change my default shell to bash?

    Read the article

  • Advanced Terminal / Console apps for Mac OS X?

    - by Jakob Egger
    I use a lot of command line programs, very often with similar arguments. Can anyone recommend an application or a workflow that allows me to store often used shell commands and search through my recent commands, using a GUI? I have commands that I use very often (eg. rsync a specific directory to a server) and other commands that I use less often. Creating shell scripts for every code snippet I might reuse seems a bit awkward. Especially for programs that I use seldomly, I end up reading the docs over and over again, because I forgot to write down the exact shell command. Ideally I would like an app that's just like Terminal.app, but provides some kind of history and snippet management. What do you use to keep track of shell commands?

    Read the article

  • Django's manage.py shell won't indent

    - by hora
    I seem to have run into a strange bug or more likely some setting I am unfamiliar with on my system that is not allowing me to tab when I am in Django's shell (python manage.py shell is how I run it). For obvious reasons this is proving to be annoying since I can't do any loops or conditonals in the shell. If I hit tab it completes all functions that are available to me, like bash does in a terminal. I've tried just using spaces for my indents but I always get an indentation error. Does anyone know why this is happening and what I can do to get tab to work in my shell again? (It may be relevant to know that this is on a Ubuntu 9.04 system). Edit: tab works fine in the regular pythong shell, it's only in django's that it doesn't. Thanks.

    Read the article

  • Improper output in SSH session on OSX using FreeSSHd on Windows with cygwin bash/sh shell

    - by Tyler Clendenin
    I am testing out running an SSH server on a local Windows VM. I have installed FreeSSHd and set the command shell to "c:\cygwin\bin\sh --login -i" (bash as well) with "Use new console engine" unchecked. (When it was enabled no output would show through the ssh connection anyway) The shell seems to work, but when connecting from my OS-X terminal using ssh all of the shell results comes out ill formatted. $ ls -al total 17 drwxr-xr-x+ 1 SYSTEM Administrators 4096 Feb 2 01:00 . drwxrwxrwt+ 1 Administrator Administrators 0 Feb 2 01:01 .. -rw------- 1 SYSTEM Administrators 128 Feb 2 01:30 .bash_history -rwxr-xr-x 1 SYSTEM Administrators 1150 Feb 2 00:55 .bash_profile -rwxr-xr-x 1 SYSTEM Administrators 3754 Feb 2 00:55 .bashrc -rwxr-xr-x 1 SYSTEM Administrators 1461 Feb 2 00:55 .inputrc Any ideas on why this is happening, how I can fix this?

    Read the article

  • Improper output in SSH session on OSX using FreeSSHd on Windows with cygwin bash/sh shell

    - by Tyler Clendenin
    I am testing out running an SSH server on a local Windows VM. I have installed FreeSSHd and set the command shell to "c:\cygwin\bin\sh --login -i" (bash as well) with "Use new console engine" unchecked. (When it was enabled no output would show through the ssh connection anyway) The shell seems to work, but when connecting from my OS-X terminal using ssh all of the shell results comes out ill formatted. $ ls -al total 17 drwxr-xr-x+ 1 SYSTEM Administrators 4096 Feb 2 01:00 . drwxrwxrwt+ 1 Administrator Administrators 0 Feb 2 01:01 .. -rw------- 1 SYSTEM Administrators 128 Feb 2 01:30 .bash_history -rwxr-xr-x 1 SYSTEM Administrators 1150 Feb 2 00:55 .bash_profile -rwxr-xr-x 1 SYSTEM Administrators 3754 Feb 2 00:55 .bashrc -rwxr-xr-x 1 SYSTEM Administrators 1461 Feb 2 00:55 .inputrc Any ideas on why this is happening, how I can fix this?

    Read the article

  • "shell not found" on start of backtrack 5

    - by Jor-el
    I am using backtrack5 in VMware on my system. I was trying to change my default shell to ksh. After executing the 'chsh' command. On restarting the OS, it shows "Cannot execute ksh: no such file or directory", which apparently because of giving a bad path while changing shell. Because of this I am not able to start the OS, as I have no terminal to interact with (cannot start the GUI). Now I need to restore the previous shell, but I don't have any access to the terminal. Thanks for the help.

    Read the article

  • Why is this rkhunter script sending empty emails?

    - by Oddthinking
    I have started running rkhunter (a security monitoring tool) and I have finally managed to clear all of its warnings. Now, a cron job runs every day to monitor my machine. Rather than send me an email of warnings, it sends me an email with no body - which I don't really want. Looking at the (unedited, straight out of the box) /etc/cron.daily/rkhunter script, it contains this snippet of shell code: if [ -s "$OUTFILE" ]; then ( echo "Subject: [rkhunter] $(hostname -f) - Daily report" echo "To: $REPORT_EMAIL" echo "" cat $OUTFILE ) | /usr/sbin/sendmail $REPORT_EMAIL fi The -s clause should prevent empty emails from being sent, right? Does anyone have an explanation why this would still send empty emails?

    Read the article

  • Persisting settings without using Options dialog in Visual Studio

    - by Utkarsh Shigihalli
    Originally posted on: http://geekswithblogs.net/onlyutkarsh/archive/2013/11/02/persisting-settings-without-using-options-dialog-in-visual-studio.aspxIn one of my previous blog post we have seen persisting settings using Visual Studio's options dialog. Visual Studio options has many advantages in automatically persisting user options for you. However, during our latest Team Rooms extension development, we decided to provide our users; ability to use our preferences directly from Team Explorer. The main reason was that we had only one simple option for user and we thought it is cumbersome for user to go to Tools –> Options dialog to change this. Another reason was, we wanted to highlight this setting to user as soon as he is using our extension.   So if you are in such a scenario where you do not want to use VS options window, but still would like to persist the settings, this post will guide you through. Visual Studio SDK provides two ways to persist settings in your extensions. One is using DialogPage as shown in my previous post. Another way is to use by implementing IProfileManager interface which I will explain in this post. Please note that the class implementing IProfileManager should be independent class. This is because, VS instantiates this class during Tools –> Import and Export Settings. IProfileManager provides 2 different sets of methods (total 4 methods) to persist the settings. They are LoadSettingsFromXml and SaveSettingsToXml – Implement these methods to persist settings to disk from VS settings storage. The VS will persist your settings along with other options to disk. LoadSettingsFromStorage and SaveSettingsToStorage – Implement these methods to persist settings to local storage, usually it be registry. VS calls LoadSettingsFromStorage method when it is initializing the package too. We are going to use the 2nd set of methods for this example. First, we are creating a separate class file called UserOptions.cs. Please note that, we also need to implement IComponent, which can be done by inheriting Component along with IProfileManager. [ComVisible(true)] [Guid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")] public class UserOptions : Component, IProfileManager { private const string SUBKEY_NAME = "TForVS2013"; private const string TRAY_NOTIFICATIONS_STRING = "TrayNotifications"; ... } Define the property so that it can be used to set and get from other classes. public bool TrayNotifications { get; set; } Implement the members of IProfileManager. public void LoadSettingsFromStorage() { RegistryKey reg = null; try { using (reg = Package.UserRegistryRoot.OpenSubKey(SUBKEY_NAME)) { if (reg != null) { // Key already exists, so just update this setting. TrayNotifications = Convert.ToBoolean(reg.GetValue(TRAY_NOTIFICATIONS_STRING, true)); } } } catch (TeamRoomException exception) { TrayNotifications = true; ExceptionReporting.Report(exception); } finally { if (reg != null) { reg.Close(); } } } public void LoadSettingsFromXml(IVsSettingsReader reader) { reader.ReadSettingBoolean(TRAY_NOTIFICATIONS_STRING, out _isTrayNotificationsEnabled); TrayNotifications = (_isTrayNotificationsEnabled == 1); } public void ResetSettings() { } public void SaveSettingsToStorage() { RegistryKey reg = null; try { using (reg = Package.UserRegistryRoot.OpenSubKey(SUBKEY_NAME, true)) { if (reg != null) { // Key already exists, so just update this setting. reg.SetValue(TRAY_NOTIFICATIONS_STRING, TrayNotifications); } else { reg = Package.UserRegistryRoot.CreateSubKey(SUBKEY_NAME); reg.SetValue(TRAY_NOTIFICATIONS_STRING, TrayNotifications); } } } catch (TeamRoomException exception) { ExceptionReporting.Report(exception); } finally { if (reg != null) { reg.Close(); } } } public void SaveSettingsToXml(IVsSettingsWriter writer) { writer.WriteSettingBoolean(TRAY_NOTIFICATIONS_STRING, TrayNotifications ? 1 : 0); } Let me elaborate on the method implementation. The Package class provides UserRegistryRoot (which is HKCU\Microsoft\VisualStudio\12.0 for VS2013) property which can be used to create and read the registry keys. So basically, in the methods above, I am checking if the registry key exists already and if not, I simply create it. Also, in case there is an exception I return the default values. If the key already exists, I update the value. Also, note that you need to make sure that you close the key while exiting from the method. Very simple right? Accessing and settings is simple too. We just need to use the exposed property. UserOptions.TrayNotifications = true; UserOptions.SaveSettingsToStorage(); Reading settings is as simple as reading a property. UserOptions.LoadSettingsFromStorage(); var trayNotifications = UserOptions.TrayNotifications; Lastly, the most important step. We need to tell Visual Studio shell that our package exposes options using the UserOptions class. For this we need to decorate our package class with ProvideProfile attribute as below. [ProvideProfile(typeof(UserOptions), "TForVS2013", "TeamRooms", 110, 110, false, DescriptionResourceID = 401)] public sealed class TeamRooms : Microsoft.VisualStudio.Shell.Package { ... } That's it. If everything is alright, once you run the package you will also see your options appearing in "Import Export settings" window, which allows you to export your options.

    Read the article

  • Problem with Bash script: 'declare: not found'

    - by Ashfame
    I had a script which was running fine but when I ran it today, it says declare: not found. I am using bash shell and path at the starting of the script is correct. Two flagged lines in my script are as follows: declare -a RESPONSE RESPONSE=($RESULT) It also says ( is unexpected but I guess that is coming up because of the first error. Worth mentioning point is when I type in declare directly works fine. declare | grep USER shows USER=ashfame USERNAME=ashfame values="$SVN_BASH_USERNAME"; So, whats wrong here?

    Read the article

  • Script to email files content

    - by Tarun
    I have created a shell script that takes backups everyday and emails its execution as successfull or unsuccessfull. Now I want that it send the contents of log file it creates with the mail as well. I have seen how to send file as attachement but I want to send the contents of the file as email message and not the file. Please Help. Its code is like #Email Settings Message_Success="Database Backup generated successfully" Message_Failure="Problem occured while generating Database Backup please verify" Subject="Database Backup Status Mail" Recipients="[email protected]" #Verify Backup Created if [ -f "$Path_Mysql_Dump" ]; then echo "Database Backup Created" >> $Path_Log_File echo "$Message_Success" | mail -s "$Subject" "$Recipients" else echo "Database Backup not created please verify the process will terminate" >> $Path_Log_File echo "$Message_Failure" | mail -s "$Subject" "$Recipients" exit -1 fi

    Read the article

  • Learning the command line [duplicate]

    - by Billy
    This question already has an answer here: What is the best way to learn how to use Ubuntu with terminal? 3 answers This isn't really a technical question but I am curious as to how long it takes to learn the linux command line. I would like to learn how to be able to do as much as possible easily from the command line. I just bought a book, linux command line and shell scripting bible. I know that this book will be of great help, but i just have no clue how long it will be before i can successfully naviagte the terminal with ease. If you could post and let me know about your experience with the terminal, and the learning process, that would be greatly appreciated. Thank you in advance.

    Read the article

  • How can I tweak this split-tar-gz-archive script?

    - by Sai
    I came across this shell script that can be used to split an entire directory across multiple compressed files. I am interested in making a minor tweak to this script. Lets say I have n GB of files in a directory. I do not want the contents of a particular folder to be split across multiple tar files but inside the same file. I want the n MB folder to be fit within a single compressed file and the remaining (n GB -n MB) split across multiple files. I am not sure whether it is possible with this script. I was looking forward to some suggestions. Though the script has been well documented, it is quite complex to understand for me

    Read the article

  • GNOME 3.2 Menu Not Loading

    - by chazdg
    Gnome 3.2 Menu is not loading. I wanted to add a minimize and maximize to the right of my windows. So I did the following: gconftool-2 --set /apps/metacity/general/button_layout --type string "menu:minimize,maximize,close" logout and login that it per the instructions of this website: Instructions I logged out and back in and that was it. No menu. Help!!! By the way, there is a fix on this website to restore Gnome. However it did not work. Another odd thing was that Gnome Tweak Tool is black under the Shell Extension tab.

    Read the article

  • Interviewing someone for general unix skills

    - by Christophe Vanfleteren
    How would you test a developer that claims to have *nix shell experience (just to be clear, we don't want to test if someone can develop on *nix, only that they know their way around the command line). I was thinking about making them solve a problem of getting information out of log files, which would involve some basics like cat, grep, cut, ... combined with piping. What other basic knowledge would you ask for? Once again, this isn't for interviewing someone who will develop for *nix systems, and also not for *nix system admins, but just for regular developers that sometimes need to do some work on a *nix system.

    Read the article

  • Switching to Kubuntu results in low graphics mode

    - by HackToHell
    I looked at some screen shots of Kubuntu and I liked it so I went to Synaptic and installed the kubuntu-desktop package and set my desktop window manager to kde and rebooted. After reboot, I saw Kubuntu splash screen then this message; running in Low Graphical Mode. Then I was not able to dismiss the message because my mouse did not work Seemingly How to Geek had the same problem http://www.howtogeek.com/howto/ubuntu/install-kde-kubuntu-on-ubuntu/ . You will probably see that your xorg.conf file was backed up to xorg.conf.1 during the ?KDE / Kubuntu installation. Just copy the xorg.conf.1 back to xorg.conf, reboot, and everything should be fine. I also tried to do that by booting into recovery mode and then droping onto the shell. But it would not let me rename, came up with some error.

    Read the article

  • Use Adwaita Dark for Libre Office and possibly other apps too?

    - by Relik
    I would like to know how to force some apps to use the Adwaita dark theme. I noticed by default that the movie player and photo viewer apps in gnome shell use Adwaita Dark while most other apps use the Light variant. I would really like to set Libre Office to use Dark instead of Light. How would I go about doing this? I found the site below, but the instructions seem a bit outdated and they do not work for GTK3. http://urukrama.wordpress.com/2008/07/13/setting-a-custom-gtk-theme-for-specific-applications/

    Read the article

  • Why would I want to use CRaSH?

    - by Adam Tannon
    Justed stumbled across CRaSH and although it looks mighty interesting, I'm wondering why a Java developer should invest time & energy into learning (yet another) shell language. What sort of standard- and cool-applications can CRaSH be used for? Is this like a Groovy-version of Jython? I guess, when the dust settles, I'm looking for CRaSH's "wow" factors. I'm sure they're there, but after spending ~20 minutes perusing the documentation I'm just not seeing them. Thanks in advance!

    Read the article

  • Attempting to GREP details of a Java error

    - by BOMEz
    I'm running Ubuntu 11 and I'm having some issues with grep. I have a shell script (see below) which essentially checks if a certain Java program of mine is running, if not it runs it. That part works out great! If my Java application throws any kind of exception however I would like to capture that information and email it to myself. How can I go about checking to see if the call to java -jar /bin/MyApp.jar fails? I tried piping it to grep, but that doesn't seem to work. Below is the full script that I've written: #Check if MyApp.jar is running, if not run it. if [ $(ps aux | grep 'java' | grep -v grep | wc -l | tr -s "\n") -eq 0 ] then echo "PacketCapture Starting...\n" java -jar /bin/MyApp.jar echo "PacketCapture Started.\n" else echo "PacketCapture already running.\n" fi

    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

  • Compare a variable that can have numeric or string as value

    - by Tarun
    I have a variable named Seconds_Behind_Master from one of my scripts. The problem is that this variable can either have a numeric value or can also take a string NULL as its value. Now, when I try to execute this script in shell it gets executed but gives a warning like this: [: Illegal number: NULL I believe it is due to the fact that in this case the value is NULL but when it compares it with numeral value 60 it gives this warning. How can I rectify it? Here is the piece of code: Seconds_Behind_Master=$Show_Slave_Status | grep "Seconds_Behind_Master" | awk -F": " {' print $2 '} if [ "$Seconds_Behind_Master" -ge "60" ]; then echo "replication delayed greater than or equal to 60." else if [ "$Seconds_Behind_Master" = "NULL" ]; then echo "Delay is Null." fi fi

    Read the article

  • Shell script to control user initiated processes

    - by Gnanam
    Hi, I'm not a shell script expert. I'm looking for a shell script which checks for maximum number of Java processes (MyJavaStandalone) running in the system before starting/executing the current Java process. Example: Script: /home/myfolder/script.sh script.sh contains /usr/java/jdk1.6.0/bin/java MyJavaStandalone >> $DATE.log & Here, before executing "MyJavaStandalone", if there are already 10 processes running, then this current process should not be started.

    Read the article

  • Enabling Shell colours through Putty SSH

    - by Jon
    I have set a number of configurations in my .bashrc file to set the appearance of shell on my Redhat machine. However, when I login as root using Putty, the colours are not shown. I can enable them again by typing 'su', which simply puts me back to root like I was when I logged into putty, but that isn't exaclty ideal. Is there some configuration file or something I can use to enable shell colours when I login with Putty? Thanks

    Read the article

  • Issue with gpg agent in Ubuntu 12.04 after installing gnome3 shell

    - by Jeroen
    I just did a fresh install of Ubuntu 12.04. Initially things were working. But after I installed some software, the 'gpg agent' is unresponsive. I suspect it has something to do with upgrades that I downloaded from the gnome 3 ppa. When I try to sign a package, it terminates with: gpg: problem with the agent - disabling agent use debsign: gpg error occurred! Aborting.... debuild: fatal error at line 1271: running debsign failed The GPG gui tool (called "Passwords and Keys" or seahorse) isn't starting anymore either. When I click it, it tries to start and then gives up and dies after a couple of seconds. I am not sure where to look for log files of gpg agent. The only thing that I see in /var/log is in auth.log that says: May 1 20:04:14 jeroen-ubuntu gnome-keyring-daemon[1997]: couldn't create prompt for gnupg passphrase: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.keyring.SystemPrompter was not provided by any .service files Not sure if it is related, but when I try to start seahorse from the command line, I get: jeroen@jeroen-ubuntu:~$ seahorse (seahorse:4828): GLib-GIO-ERROR **: Settings schema 'org.gnome.crypto.pgp' is not installed Edit: I fixed the seahorse GUI by manually downloading and reinstalling gnome-keyring version from precise instead of the ppa. However, I still cannot sign packages.

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >