0
votes
1answer
10 views

alias can't find a file that actually exists

On my personnal computer, not a server, in my .bash_profile (I'm on OSX) — sym-linked to .bashrc, I have the following line among some others : alias deploy=sh ~/dir/ectory/deploy.sh The file ...
1
vote
2answers
19 views

How to stop shell script if curl failed

I have script that used curl when i pass wrong parameters to script curl failed but script continue executing. I have tried use curl -f/--fail parameter but problem does not solved. What is the best ...
0
votes
0answers
26 views

Unable to run tmux on OS X

So I got brew on my mac and I had tmux installed and running just fine. Then after I refreshed my system every time I try to run tmux i get this error: "-bash: tmux: command not found" So since I'm ...
0
votes
1answer
25 views

How to print process id into statment

I have assigned a work to take take all process and make them into a statement. So I tried this script. #!/bin/bash a= ps | awk '{print $1}' echo select $a So I am getting this output PID 1838 ...
1
vote
1answer
21 views

How do I identify shell script execution vs dot execution

I'm writing a bash script that needs to run on the current process for it to be useful. That is, I want to make sure that the script was invoked with source script.sh or . ./script.sh and not ...
1
vote
0answers
30 views

Terminal's bin/bash not responding

I have Googled through several instances of this issue but cannot get Terminal to open up with bash. I restarted the program, the computer and even logged in through another Administrator account but ...
0
votes
1answer
18 views

find files older than create its parent folder in a directory and move them there

I've been trying to create a bash script that does the following. Use the find command to search for files older than 7 days (find . -type f -mtime +7 ! -iname '.*', take the parent directory(of the ...
2
votes
1answer
40 views

What's the ZSH equivalent of BASH's $PROMPT_COMMAND?

BASH supports a $PROMPT_COMMAND environment variable that defines a command to be executed before any first-level interactive prompt. I'm looking for a ZSH equilvalent of that. The documentation says ...
0
votes
1answer
72 views

How do you run a command as another user on Linux?

I have access to a linux server where I can sudo to 'foo' like this without a password: sudo su - foo Once I am the 'foo' user I am able to run a script like this: /dir/foo_user_script.sh The ...
1
vote
4answers
42 views

Skip parameter in Linux bash

I need to write a shell-script which handles 3 parameters ($1 $2 and $3). Within the bash I have to skip parameter 2 (I'm actually writing something like ./script.sh para1 para3). The script is OK. ...
0
votes
0answers
17 views

Vagrantfile - is rvm in ~/.rvm/scripts/rvm or ~/.rvm/bin/rvm?

I'm still learning my way around some of the more hidden files in terminal and I was trying to setup a Vagrant box with rails via shell script provisioning, with some help from these links: ...
3
votes
1answer
50 views

#!/bin/bash -e :: what is `-e`? other arguments?

I am a shell script coder that always opt to use shell as top level as part of my belt in creating website apps on the fly and have relied on my bash scripts if I want a project to be implemented ...
2
votes
1answer
43 views

Is there a way around broken pipe?

I have a directory with a large number of files. ./I_am_a_dir_with_many_subdirs/ Within a script I'd like to find all subdirs in it, to sort them and to output to a bash array. So, I do: ...
0
votes
0answers
13 views

(MAC) Change location of shell script's shell

When I make an executable shell script ("http://chimpy.wordpress.com/2010/08/29/mac-os-x-shortcut-link-to-python-script/", but without the python part), It's pointer location (The location commands ...
0
votes
0answers
25 views

open a new screen in linux, no access to perl local library

I added my perl local library to my shell startup script (.bashrc) and when I start a terminal in linux: $ echo $PERL5LIB /home/perl5/lib/perl5:/usr/share/vcftools/perl BUT when I open a new ...
0
votes
1answer
42 views

input from shell in bash script

i have a bash script i would like modify to support input from shell atm i have to type the link after i have run the script wiak@test:~$ scripts/lget.sh gimme cookie! ...
3
votes
2answers
154 views

Linking multiple files

In bash, say I want to link some but not all files from a directory, e.g., ln -s /dir/file1 /dir/file2 ... /other/dir but the format of the names of the files do not follow some simple rule, so we ...
0
votes
1answer
42 views

CygWin terminal in remote console (SSH) not starting at correct $HOME path

I have installed CygWin v1.7.28. The problem quickly explained: Basically, when starting a CygWin shell via remote login, the $HOME is not where it should, with all derivated (bad) consequences of ...
0
votes
2answers
40 views

Shell not expanding *

I am setting up a java classpath in a bash script. I thought that I would have to use quotes to prevent shell from expanding the * based on this question: ...
1
vote
3answers
52 views

Is the word shell a synonym of process?

From this article: Sourcing will execute the commands in the current shell, executing will create a new shell and execute the commands there. He describes that each shell has its own PID. I ...
0
votes
2answers
26 views

Zsh: how to auto complete after a command?

everyone. It's a little difficult to explain what I want to do. I want to create a script 'example', which can input long commands for you after you run it with short parameters. For example, $ ...
0
votes
2answers
31 views

Difference between “ls -lh” & “ls -lh | tail -n +2”

I was going through the split command article on internet and came across this Linux command ls -lh | tail -n +2 for listing files. Is it any better than ls -ltrh (which shows almost the same listing) ...
1
vote
3answers
81 views

Tool to record an interactive bash session to shell script

Is there a tool to record an interactive shell session to a shell script? For example if we entered in a terminal: interactive2sh reconfig_foo vim /etc/foo.cfg ibar^ESC:q /etc/init.d/foo restart ...
0
votes
1answer
30 views

commands depending on std input not working right

that's my code bash << EOF read EOF here, the read command fails and it doesn't read from the std input and here bash << EOF read ls ls EOF only the second ls is ...
-1
votes
3answers
47 views

Create one file per line via shell

I have a file containing list of filenames, like this file1.cfg file2.cfg file3.cfg I want, using the linux terminal, to split this into n files with the given filename, each also containing the ...
1
vote
2answers
40 views

What is the equivalent of bash's !$ and !! in the fish shell?

I've been using bash for a decade or so and have gotten used to being able to type !$ to repeat the last argument, e.g.: $ mkdir foo $ cd !$ cd foo (That last line is printed by the shell to tell ...
0
votes
1answer
41 views

bash: Running a program from the console without holding it up or line noise

I would like to run programs (for example, opening PDFs in Evince) from my bash shell. However, when I do this the simplest way (evince filename.pdf), the shell doesn't let me input anything until I ...
0
votes
3answers
25 views

How to get out of being suspended by bash console?

In unix-like system terminal, I sometimes used some commands incorrectly and make bash don't know what to do, but just pending on a newline. e.g. grep 'word' -R Then how can I make up to the ...
0
votes
1answer
39 views

Bash single quotes in find command

I'm having some troubles getting a shell script to work. I'm trying to dynamically generate the find command based on user input and I'm running into the problem that my variables in the find command ...
0
votes
2answers
38 views

How to compare the contents of two directory using bash?

I have 2 directories that should contain the same files and the same directory structure. I think that in one of these directories missing something. Using the bash shell are there a way to compare ...
0
votes
0answers
63 views

find command with exec sh doesn't work in shell script but in commandline (raspberrypi)

I want to find "old" folders in /volume1/photo/ipcam which are named like "????-??-??" and move corresponding folders within dropbox (with the same directory structure /ipcam/...) to the subfolder ...
2
votes
2answers
59 views

env -i zsh | How is this magic possible?

I'm currently working, for school, on a home-made shell, therefore I'm kind of curious nowadays about how shell vars are set. Yes, this can be really exciting ! Anyway, we obviously have to deal with ...
1
vote
1answer
32 views

Linux Bash Shell - File globbing specific range?

I have a bunch of files in a folder: spreadsheet700.xls spreadsheet800.xls spreadsheet850.xls spreadsheet1005.xls spreadsheet2400.xls how can I use file globbing to select files that numbers end in ...
1
vote
0answers
48 views

Cron deamon written in shell

I'm looking for a script in bash or ksh, that would do ... more or less ... the same as crond. The situation is, that our system administrator suddenly denied the use of crontab to all regular users ...
-2
votes
1answer
44 views

On telnet session file edit not happening using vi editor

I used rlwrap because with telnet session arrow keys were not working, after starting telnet session with rlwrap am not able to edit the file in using vi editor. Whether its problem with rlwrap.If i ...
0
votes
0answers
28 views

Ubuntu: `env -i bash --norc`, but include essential variables such as HOME, DISPLAY? (where are these set?)

Is there an easy way to isolate a session of bash so that only essential variables (HOME, USER, DISPLAY, etc.) are preserved? (essential in that many programs fail if HOME, DISPLAY, TERM, SHELL, etc. ...
1
vote
2answers
86 views

Mac Terminal showing bash instead of my username

This makes it hard to know what directory I am in. I installed a version of python for school and now it says -bash-3.2$ instead of MyMacbook: ~$. I'm sure this is really simple, but I know nothing ...
1
vote
1answer
38 views

permission denied in running script

I am running a script but there is an unusual warning: This is what happened in my console #whoami root #ls -l test.sh -rwxr-xr-x. 1 root root 1894 Feb 2 01:58 test.sh #./test.sh -bash: ./test.sh: ...
0
votes
1answer
25 views

Is it possible to connect to the local Windows shell with PuTTY?

I don't know of a working Windows SSH server (not one that I trust enough, yet, at any rate). Therefore, I can't simply connect to localhost on port 22 from PuTTY. I want to use PuTTY because the ...
0
votes
0answers
31 views

How can my bash script inherit core limits from a C shell?

I'm using tcsh for my shell. I disable core dumps by running "limit core 0". Running a program that crashes from my shell, I can see that indeed no core dump is generated. Next I have a wrapper ...
2
votes
4answers
200 views

Bash script, string not replaced correctly with escaped $ and & characters

I have created a shell script which takes a string as input. If the string contains $ or &, then I need to replace those characters with \$ and \&. I could done that with sed command. After ...
1
vote
2answers
50 views

How to set specific file permissions when redirecting output?

This is probably a duplicate, but all my searches are turning up questions about permission denied errors. I am running a command in a bash shell. I want to redirect output to append to a file that ...
1
vote
2answers
71 views

How to insert bash scripts inside the PS1 variable

I made a custom PS1 variable, which is a tremendously confusing. Here is the one that is closest to being fully working: PS1="\n[\e[1;31m]\u@\H[\e[35m] \@ [\e[32m] PWD: \w [\e[1;34m]This folder ...
3
votes
3answers
213 views

Why do people source bash_profile from bashrc instead of the other way round?

It sounds like most terminal emulators don't run local sessions as login by default, so they'll load bashrc rather than bash_profile. So why do most people put everything in bash_profile and have ...
0
votes
0answers
25 views

How do I determine whether a program other than bash is running in a different pane in tmux, and if so suspend it and return to the shell temporarily?

I am trying to write a bash script to script tmux and do things in every pane in my current window. That I have down, but I'd like to be able to know if another window is running the shell or if I'm ...
0
votes
3answers
84 views

How to delete all hidden .swp files from terminal

How can I delete all .swp files? I tried rm *.swp but I got rm: *.swp: No such file or directory rwxr-xr-x 16 teacher staff 544 Jan 17 13:19 . drwxr-xr-x 19 teacher staff 646 Jan 16 12:48 ...
1
vote
1answer
45 views

Prevent braces in BASH to create sub-shell

I need braces to specify evaluation priority of expressions, but I don't want braces to create sub-scripts. Look what happens when that example code is ran: Example script #!/bin/bash false || ...
1
vote
2answers
205 views

Linux: How can I delete all files whose file name is more than X characters in length?

I want to delete all files in the current directory and sub directories whose file name is more than a particular length. Is there an easy way of doing this from bash?
3
votes
2answers
146 views

Shell script running from cron not running python

I have python program, I want to run it everyday with different variable (on CentOS server): #!/bin/sh /usr/bin/python /root/testing/test.py --variables /root/testing/daily/test1.txt while [ $? != 0 ...
0
votes
1answer
39 views

Trouble 'generating' bash aliases

In my ~/.shortcuts, I have symlinks to some frequently used directories. In .bashrc (OS X), I am doing this: ls -1 ~/.shortcuts | xargs -I {} alias {}="'cd -P ~/.shortcuts/{}'" When I run alias in ...