Search Results

Search found 3730 results on 150 pages for 'bash'.

Page 10/150 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • send process straight to bg in bash

    - by ItsNannerpuss
    I find I frequently use the combination of Suspend (^Z) then send to background (bg) in bash. Ideally I would like an alternate keyboard shortcut that negates the need to follow ^Z with the bg command, and just send the active process straight to background. Does this exist? Edit: I should have been more specific, but appending & to the command is not sufficient, as they often require interaction (stdin) between launch and backgrounding. So: launch interact background

    Read the article

  • How to overwrite the data in a file with bash

    - by Stefan Liebenberg
    I'm writing a bash script that encrypts the data of a folder or file #!/bin/bash file_name=$1 tmp_file=/tmp/tmpfile.tar # tar compress file tar -cf $tmp_file $file_name; # encrypt file gpg -c $tmp_file # remove temp file rm -rf $tmp_file $file_name # mv encrypted file to orignal place mv ${tmp_file}.gpg $file_name but the data will still be recoverable by using photorec or similar methods... Is there a way to ensure the absolute deletion of the original file in bash? Thank You Stefan

    Read the article

  • How to automatically add user account *and* password with a Bash script

    - by ModernCarpentry
    I need to have the ability to create user accounts on my Linux ( Fedora 10 ) and automatically assign a password via a bash script ( or otherwise, if need be ). It's easy to create the user via Bash eg: [whoever@server ]# /usr/sbin/useradd newuser But is it possible to assign a password in Bash, something functionally similar to this (but automated): [whoever@server ]# passwd newuser Changing password for user testpass. New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully. [whoever@server ]#

    Read the article

  • bash script to check running process

    - by elasticsecurity
    I wrote a bash-script to check if a process is running. It doesn't work since the ps command always returns exit code 1. When I run the ps command from the command-line, the $? is correctly set, but within the script it is always 1. Any idea? #!/bin/bash SERVICE=$1 ps -a | grep -v grep | grep $1 > /dev/null result=$? echo "exit code: ${result}" if [ "${result}" -eq "0" ] ; then echo "`date`: $SERVICE service running, everything is fine" else echo "`date`: $SERVICE is not running" fi Bash version: GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)

    Read the article

  • Quicker searching in JScript using the Bash

    - by gentlesea
    I am using the following JScript code to search for a string inside a file: var myFile = aqFile.OpenTextFile(fileToSearchIn, aqFile.faRead, aqFile.ctANSI); while(!myFile.IsEndOfFile()) { s = myFile.ReadLine(); if (aqString.Find(s, searchString) != -1) Log.Checkpoint(searchString + " found.", s); } myFile.Close(); This is rather slow. I was thinking about using bash commands in order to speed up the search in file process: var WshShell = new ActiveXObject("WScript.Shell"); var oExec = WshShell.Exec("C:\\cygwin\\bin\\bash.exe -c 'cat \"" + folderName + "/" + fileName + "\"'"); while (!oExec.StdOut.AtEndOfStream) Log.Checkpoint(oExec.StdOut.ReadLine()); while (!oExec.StdErr.AtEndOfStream) Log.Error(oExec.StdErr.ReadLine()); Since every time bash.exe is started a new window opens the searching is not faster than before. Is there a possibility to have the bash run in the background using another switch?

    Read the article

  • Bash script to log in over SSH

    - by user1042928
    Sorry if this seems like a dumb question but I am just learning bash scripting. For a school project we need to code an RTX that runs in Unix. It runs as a process in terminal and takes in user input and then prints it to the screen. I want to write a bash script to test that it can respond to lots of quick user input without overflowing or failing. My main problem is that once the RTX starts the bash script will stop on that line until the RTX terminates and only then print the loop to the terminal (instead of printing it to the RTX prompt as I intend it to). I have tried running the RTX in the background but that didn't work. I need to find a way to redirect input to the RTX while it is still running with a bash script. Google searches didn't come up with examples that I understood/could adapt. Any help is appreciated. #!/bin/bash # declare STRING variable STRING="RTX Worked =D" #Start the rtx in a new process, stuck on this line until rtx terminates. ./main #Somehow redirect io to the rtx. for i in `seq 1 100`; do echo $i echo " \n" done echo $STRING

    Read the article

  • Unable to modify git bash Windows shortcut

    - by netgirlk
    Under Windows 7 I'd like to change the settings for the Git Bash Here shell extension command window, e.g. width, height and font. But when I do this, I get an error "Unable to modify the shortcut". I can modify the shortcut for Git Bash in the Start menu by using "Run as administrator..." This works, but only for Bash windows opened from the Start menu. It doesn't work for the "Git Bash Here" shell extension and there's no "Run as administrator..." option on right-click context menu. How do you do it?

    Read the article

  • Bash sourcing of functions in other languages

    - by ABach
    This is, perhaps, a silly question, but it's something that I've wondered about: is it possible to, say, define a Ruby/Python/Perl/etc. function in some file and then source it in Bash (to make it available anywhere in the current shell)? At the moment, I "source" scripts/functions in other languages by creating a bash alias that executes that script... But I wonder if it's possible for Bash to interpret those other functions directly? Thanks. :)

    Read the article

  • Bash can't start a programme that's there and has all the right permissions

    - by Rory
    This is a gentoo server. There's a programme prog that can't execute. (Yes the execute permission is set) About the file $ ls prog $ ./prog bash: ./prog: No such file or directory $ file prog prog: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped $ pwd /usr/local/bin $ /usr/local/bin/prog bash: /usr/local/bin/prog: No such file or directory $ less prog | head ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: Intel 80386 Version: 0x1 I have a fancy less, to show that it's an actual executable, here's some more data: $ xxd prog |head 0000000: 7f45 4c46 0101 0100 0000 0000 0000 0000 .ELF............ 0000010: 0200 0300 0100 0000 c092 0408 3400 0000 ............4... 0000020: 0401 0a00 0000 0000 3400 2000 0700 2800 ........4. ...(. 0000030: 2600 2300 0600 0000 3400 0000 3480 0408 &.#.....4...4... 0000040: 3480 0408 e000 0000 e000 0000 0500 0000 4............... 0000050: 0400 0000 0300 0000 1401 0000 1481 0408 ................ 0000060: 1481 0408 1300 0000 1300 0000 0400 0000 ................ 0000070: 0100 0000 0100 0000 0000 0000 0080 0408 ................ 0000080: 0080 0408 21f1 0500 21f1 0500 0500 0000 ....!...!....... 0000090: 0010 0000 0100 0000 40f1 0500 4081 0a08 ........@...@... and $ ls -l prog -rwxrwxr-x 1 1000 devs 725706 Aug 6 2007 prog $ ldd prog not a dynamic executable $ strace ./prog 1249403877.639076 execve("./prog", ["./prog"], [/* 27 vars */]) = -1 ENOENT (No such file or directory) 1249403877.640645 dup(2) = 3 1249403877.640875 fcntl(3, F_GETFL) = 0x8002 (flags O_RDWR|O_LARGEFILE) 1249403877.641143 fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 1249403877.641484 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b3b8954a000 1249403877.641747 lseek(3, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) 1249403877.642045 write(3, "strace: exec: No such file or dir"..., 40strace: exec: No such file or directory ) = 40 1249403877.642324 close(3) = 0 1249403877.642531 munmap(0x2b3b8954a000, 4096) = 0 1249403877.642735 exit_group(1) = ? About the server FTR the server is a xen domU, and the programme is a closed source linux application. This VM is a copy of another VM that has the same root filesystem (including this programme), that works fine. I've tried all the above as root and same problem. Did I mention the root filesystem is mounted over NFS. However it's mounted 'defaults,nosuid', which should include execute. Also I am able to run many other programmes from that mounted drive /proc/cpuinfo: processor : 0 vendor_id : GenuineIntel cpu family : 15 model : 4 model name : Intel(R) Xeon(TM) CPU 3.00GHz stepping : 1 cpu MHz : 2992.692 cache size : 1024 KB fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu tsc msr pae mce cx8 apic mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl cid cx16 xtpr bogmips : 5989.55 clflush size : 64 cache_alignment : 128 address sizes : 36 bits physical, 48 bits virtual power management: Example of a file that I can run I can run other programmes on that mounted filesystem on that server. For example: $ ls -l ls -rwxr-xr-x 1 root root 105576 Jul 25 17:14 ls $ file ls ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), stripped $ ./ls attr cat cut echo getfacl ln more ... (you get the idea) ... rmdir sort tty $ less ls | head ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: Advanced Micro Devices X86-64 Version: 0x1

    Read the article

  • segfault when cd-ing into certain directories in bash

    - by user84207
    I have noticed this very strange behavior recently. After cd into certain directories, I get a segfault on the terminal. --- SIGSEGV (Segmentation fault) @ 0 (0) --- --- SIGSEGV (Segmentation fault) @ 0 (0) --- +++ killed by SIGSEGV (core dumped) +++ segmentation fault (core dumped) I proceeded to strace a bash session in which I cd into the target directory, and was able to reproduce the problem. I attached the log to this pastebin: I paste below the few lines from the read of "cd stumpwm", which is the directory in question, until the segfault. I included a few of the repetitions of calls to "rt_sigprocmask" and "brk" to give a glimpse of the pattern, which occurs for most of the strace, read(0, cd stumpwm "c", 1) = 1 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 read(0, "d", 1) = 1 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 read(0, " ", 1) = 1 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 read(0, "s", 1) = 1 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 read(0, "t", 1) = 1 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 read(0, "u", 1) = 1 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 read(0, "m", 1) = 1 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 read(0, "p", 1) = 1 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 read(0, "w", 1) = 1 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 read(0, "m", 1) = 1 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 read(0, "\n", 1) = 1 rt_sigprocmask(SIG_BLOCK, [INT], [], 8) = 0 ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig -icanon -echo ...}) = 0 ioctl(0, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig icanon -echo ...}) = 0 ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon -echo ...}) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 rt_sigaction(SIGINT, {0x457d50, [], SA_RESTORER, 0x7ffff76254a0}, {0x49edc0, [], SA_RESTORER, 0x7ffff76254a0}, 8) = 0 rt_sigaction(SIGTERM, {SIG_IGN, [], SA_RESTORER, 0x7ffff76254a0}, {SIG_IGN, [], SA_RESTORER, 0x7ffff76254a0}, 8) = 0 rt_sigaction(SIGQUIT, {SIG_IGN, [], SA_RESTORER, 0x7ffff76254a0}, {SIG_IGN, [], SA_RESTORER, 0x7ffff76254a0}, 8) = 0 rt_sigaction(SIGALRM, {0x457f50, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x7ffff76254a0}, {0x49edc0, [], SA_RESTORER, 0x7ffff76254a0}, 8) = 0 rt_sigaction(SIGTSTP, {SIG_IGN, [], SA_RESTORER, 0x7ffff76254a0}, {SIG_IGN, [], SA_RESTORER, 0x7ffff76254a0}, 8) = 0 rt_sigaction(SIGTTOU, {SIG_IGN, [], SA_RESTORER, 0x7ffff76254a0}, {SIG_IGN, [], SA_RESTORER, 0x7ffff76254a0}, 8) = 0 rt_sigaction(SIGTTIN, {SIG_IGN, [], SA_RESTORER, 0x7ffff76254a0}, {SIG_IGN, [], SA_RESTORER, 0x7ffff76254a0}, 8) = 0 rt_sigaction(SIGWINCH, {0x457920, [], SA_RESTORER, 0x7ffff76254a0}, {0x49e6e0, [], SA_RESTORER|SA_RESTART, 0x7ffff76254a0}, 8) = 0 rt_sigaction(SIGINT, {0x457d50, [], SA_RESTORER, 0x7ffff76254a0}, {0x457d50, [], SA_RESTORER, 0x7ffff76254a0}, 8) = 0 brk(0xa9a000) = 0xa9a000 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 brk(0xa9b000) = 0xa9b000 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 brk(0xa9c000) = 0xa9c000 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 brk(0xa9d000) = 0xa9d000 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 brk(0xa9e000) = 0xa9e000 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 brk(0xa9f000) = 0xa9f000 brk(0xaa0000) = 0xaa0000 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 brk(0xaa1000) = 0xaa1000 brk(0xaa2000) = 0xaa2000 (pattern of rt_sigprocmask, brk continues ...) rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 brk(0x1d5b000) = 0x1d5b000 brk(0x1d5c000) = 0x1d5c000 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 brk(0x1d5d000) = 0x1d5d000 brk(0x1d5e000) = 0x1d5e000 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 --- SIGSEGV (Segmentation fault) @ 0 (0) --- --- SIGSEGV (Segmentation fault) @ 0 (0) --- +++ killed by SIGSEGV (core dumped) +++ segmentation fault (core dumped) How can I debug this? Is this likely to be a bash problem? The error does not occur with another shell, such as eshell. I have also run an fschk, although I haven't been able to see the output because of this bug.

    Read the article

  • In GNU Screen, Recalled bash history command displays one character position to the left of actual location

    - by vergueishon
    I am running Red Hat 5 32-bit (2.6.18-194.26.1.el5). The issue is that when I recall any previous command in bash's history, the first character in the command is displayed immediately after the shell prompt, without any intervening space, likeso: \[me@mymachine tmp]$man mysql If I enter a Ctrl-C, and retype the command, it looks likeso: \[me@mymachine tmp]$ man mysql This makes recalling a command and editing it before re-entering a real pain. Basically, if I try to edit a recalled command, my changes occur one character position to the left (I believe) of what I see on the screen. It's a bit tedious to describe, and appears to only happen with commands with a large number of arguments. UPDATE: The contents of /etc/sysconfig/bash-prompt-screen, 1 #!/bin/bash 2 echo -n $'\033'"_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"$'\033\\\\' and the contents of /etc/bashrc, 24 screen) 25 if [ -e /etc/sysconfig/bash-prompt-screen ]; then 26 PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen 27 else 28 PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"' 29 fi 30 ;; I've disable bash-prompt-screen by renaming it--this fixed it. It's entirely possible that there is a fix to the bash-prompt-screen prompt line in the latest version of screen for RHEL 5. The error is seen under Screen version 4.00.03 (FAU) 23-Oct-06. (I noticed an update in the queue, which is installing as I write this.)

    Read the article

  • Proper way to let user enter password for a bash script using only the GUI (with the terminal hidden)

    - by MountainX
    I have made a bash script that uses kdialog exclusively for interacting with the user. It is launched from a ".desktop" file so the user never sees the terminal. It looks 100% like a GUI app (even though it is just a bash script). It runs in KDE only (Kubuntu 12.04). My only problem is handling password input securely and conveniently. I can't find a satisfactory solution. The script was designed to be run as a normal user and to prompt for the password when a sudo command is first needed. In this way, most commands, those not requiring sudo rights, are run as the normal user. What happens (when the script is run from the terminal) is that the user is prompted for their password once and the default sudo timeout allows the script to finish, including any additional sudo commands, without prompting the user again. This is how I want it to work when run behind the GUI too. The main problem is that using kdesudo to launch my script, which is the standard GUI way, means that the entire script is executed by the root user. So file ownerships get assigned to the root user, I can't rely upon ~/ in paths, and many other things are less than ideal. Running the entire script as the root user is just a very unsatisfactory solution and I think it is a bad practice. I appreciate any ideas for letting a user enter the sudo password just once via GUI while not running the whole script as root. Thanks.

    Read the article

  • getting bash to load my PATH over SSH

    - by Eli Bendersky
    This problem comes up with me trying to make svnserve (Subversion server) available on a server through SSH. I compiled SVN and installed it in $HOME/bin. Local access to it (not through SSH) works fine. Connections to svn+ssh fail due to: bash: svnserve: command not found Debugging this, I've found that: ssh user@server "which svnserve" says: which: no svnserve in (/usr/bin:/bin) This is strange, because I've updated the path to $HOME/bin in my .bashrc, and also added it in ~/.ssh/environment. However, it seems like the SSH doesn't read it. Although when I run: ssh user@server "echo $PATH" It does print my updated path! What's going on here? How can I make SSH find my svnserve? Thanks in advance

    Read the article

  • CentOS Backup BASH Script

    - by user1062058
    I just wrote this script for backing up everything into a tar.gz file. Does it look okay? How can I get the tar file to transfer itself over to another server after executing? FTP from itself? I'm going to put this script into a weekly cron. #!/bin/bash rm ~/backup.tar.gz #removes old backup BACKUP_DIRS=$HOME #$HOME is builtin, it goes to /home/ and all child dirs tar -cvzf backup.tar.gz $BACKUP_DIRS # run tar -zxvf to extract backup.tar.gz 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

  • Bash - read as a fallback to $@

    - by user137369
    I have a working bash script (working on OSX) that takes files and directories as input and does something like for inputFile in $@ do [someStuff] done but I want to provide a “fallback”, meaning, if the script is started with no arguments (double-clicked, for example), it can take input at that time, by letting the user drop the files directly on the terminal (possibly through read but not mandatory, I'm open to better/different solutions). I'm guessing I should use some kind of if statement, but I'm not sure how. I'd like to not have to essentially duplicate the script's size by two by repeating [someStuff] for each case. Thank you.

    Read the article

  • Bash color prompt and long commands

    - by Eric J.
    I'm colorizing parts of my bash prompt using ANSI escape sequences. This works great, until the command I'm currently typing in is long enough that it has to wrap. Instead of the rest of the command displaying on the next line, it wraps back to column 1 of the current line, overwriting the beginning of the prompt. I get that behavior with this prompt: export PS1="[\u][\033[0;32;40mdemo \033[0;33;40m1.5.40.b\033[0;37;40m] \w> \033[0m" but it works correctly with the same prompt, ANSI sequences remove: export PS1="[\u][demo 1.5.40.b] \w> " I'm connecting using the current version of Putty, with default Putty settings. The OS is Ubuntu 8.10.

    Read the article

  • (svh+ssh) getting bash to load my PATH over SSH

    - by Eli Bendersky
    This problem comes up with me trying to make svnserve (Subversion server) available on a server through SSH. I compiled SVN and installed it in $HOME/bin. Local access to it (not through SSH) works fine. Connections to svn+ssh fail due to: bash: svnserve: command not found Debugging this, I've found that: ssh user@server "which svnserve" says: which: no svnserve in (/usr/bin:/bin) This is strange, because I've updated the path to $HOME/bin in my .bashrc, and also added it in ~/.ssh/environment. However, it seems like the SSH doesn't read it. Although when I run: ssh user@server "echo $PATH" It does print my updated path! What's going on here? How can I make SSH find my svnserve? Thanks in advance

    Read the article

  • (svn+ssh) getting bash to load my PATH over SSH

    - by Eli Bendersky
    This problem comes up with me trying to make svnserve (Subversion server) available on a server through SSH. I compiled SVN and installed it in $HOME/bin. Local access to it (not through SSH) works fine. Connections to svn+ssh fail due to: bash: svnserve: command not found Debugging this, I've found that: ssh user@server "which svnserve" says: which: no svnserve in (/usr/bin:/bin) This is strange, because I've updated the path to $HOME/bin in my .bashrc, and also added it in ~/.ssh/environment. However, it seems like the SSH doesn't read it. Although when I run: ssh user@server "echo $PATH" It does print my updated path! What's going on here? How can I make SSH find my svnserve? Thanks in advance

    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

  • Bash delete file when variable = x

    - by twigg
    I'm creating a bash script which reboots the system at each reboot it adds a new line to a text file, I then read the text file before each reboot. Once the variable holding the number of lines reaches say 10 I want the script to delete the text file (at which point on the next reboot it will see the file isn't there, brake the loop and promote the user to start again). I tried this: exec < text.txt nol=0 while read line do nol=`expr $nol + 1` done reboot_count=10 if ["$nol" == "$reboot_count"]; then rm text.txt fi but this doesn't seem to be working, all help is appreciated :)

    Read the article

  • How can I do `dir *.mp3` in bash?

    - by Andy
    Hi all, On Windows I used to quickly run a dir *.mp3 to find all files with an mp3 extension in the current directory. Is there a similarly quick way to do it with bash? The ls command seems to have a way to ignore a pattern, but not to show only the pattern. I can do find . -maxdepth 1 -iname '*.mp3' or ls|grep -i '\.mp3$' but neither of these flow out of my fingers in half a second or less;) Any quicker alternatives? TIA Andy

    Read the article

  • About rw init=/bin/bash

    - by triedtoomuck
    I am a linux newbie so excuse me if I ask silly things. I recently find out that if I edit GRUB before booting and I add rw init=/bin/bash I end up with a root shell. Being in a condition that I want to understand everything I would like to know why this happens. I mean is it a bug? is it a feature? is it there to help admins to fix things as it only works if you have physical access to a computer? Which part are we exploiting? GRUB or the actual kernel? Sorry for asking a lot of things.

    Read the article

  • How to batch rename files using bash

    - by Alex Popov
    I know there are lots of such questions, but I couldn't find one (or a combination of several), which describes the things I want to do. I think I need to use regular expressions, but I am not very good with that. I use zsh. I have a folder with files, which I want to rename: I want the files challenge1.rb, challenge2.rb, challenge3.rb, etc. to be renamed to c1.rb, c2.rb etc. Similarly task1.rb and similar must be renamed to t1.rb etc. sample_spec_c1.rb, sample_spec_c2.rb etc. must be renamed to c1_spec.rb, c2_spec.rb etc. So I guess I need some combination of regular expressions and iteration, but I don't know how to write the bash script.

    Read the article

  • How to use HTML markup tags inside Bash script

    - by CONtext
    I have crontab and a simple bash script that sends me emails every often containing PHP, NGINX, MYSQL errors from their log files. This is a simplified example. #/home/user/status.sh [email protected] PHP_ERROR=`tail -5 /var/log/php-fpm/error.log` NGINX_ERROR=`tail -5 /var/log/nginx/error.log` MYSQL_ERROR=`tail /var/log/mysqld.log` DISK_SPACE=`df -h` echo " Today's, server report:: ================================== DISK_SPACE: $DISK_SPACE --------------------------------- MEMORY_USAGE: $MEMORY_USAGE ----------------------------------- NGINX ERROR: $NGINX_ERROR ----------------------------------- PHP ERRORS: $PHP_ERROR ------------------------------------ MYSQL_ERRORS: $MYSQL_ERROR ------------------------------------- " | mail -s "Server reports" $EMAIL I know this is a very basic usage, but as you can see, I am trying to separate the errors, but not of the html tags including \n are working. So, my question is, is it possible to use HTML tags to format the text, if not .. then what are the alternatives.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >