Posts

Showing posts with the label shell

shell script within Conda env can't execute mkdir

shell script within Conda env can't execute mkdir We are on an Ubuntu system running conda. Within an environment (python2, pandas, other packages) we are trying to run a shell script that: 1. creates dir (mkdir) 2. runs executables the path to which are in PATH (.bashrc) Neither of these are working, and I imagine is a config error on our part. Here are the errors: mkdir: cannot create directory ‘ResultsSparCC/Resamplings2’: No such file or directory mkdir: cannot create directory ‘ResultsSparCC/Bootstraps’: No such file or directory ./sparccWrapper.sh: line 31: ResultsSparCC/sparcc.log: No such file or directory Traceback (most recent call last): File "/home/charlesh/binf/src/sparcc/MakeBootstraps.py", line 9, in <module> from analysis_methods import permute_w_replacement File "/home/binf/src/sparcc/analysis_methods.py", line 7, in <module> from pandas import DataFrame as DF ImportError: No module named pandas However, pandas is installed i...

How do I write a script to identify and manipulate a specific drive in the terminal?

How do I write a script to identify and manipulate a specific drive in the terminal? I'm trying to write a short script that can automatically unmount and remount a partition, without knowing where the drive is currently mounted. The following command sort of works for me: sudo umount /dev/sdX sudo mount -t ntfs /dev/sdX /mnt/rec The issue is, I'm running Linux live, and can't install it on my hard drive. As such, whenever I reboot the computer, /dev/sdX will sometimes mount as /dev/sdb, or /dev/sdd. As such, I can't just run a script to automatically mount the drive where I need to, without using sudo fdisk -l In order to verify what the drives are currently mounted as. My question is: Is there a way to identify a drive, that's agnostic to where it's currently mounted? What does it mean to identify the drive independent of where it is mounted? What's on the drive to tell you it is the one you're after? – ...

How to get all tables of hbase in linux shell script and operate on each table?

How to get all tables of hbase in linux shell script and operate on each table? Now I can do it with this code, but is there a better way to do this? output=`echo "list" | hbase shell` output=`echo ${output} | cut -d'[' -f 2 | cut -d']' -f 1` IFS=',' read -ra tables <<< "$output" for tb in "${tables[@]}"; do echo "${tb}n" done What exactly is wrong with this? – cricket_007 Jul 1 at 4:10 I thought it is not that graceful to parse the output and wonder if there is a better way to do this. – xunyl Jul 1 at 4:15 1 Answer 1 You could si...

javac : The term 'javac' is not recognized as the name of a cmdlet, function, script file or operable program [duplicate]

Image
javac : The term 'javac' is not recognized as the name of a cmdlet, function, script file or operable program [duplicate] This question already has an answer here: I installed Java's jdk1.8. When I use the java command it works fine. But if I use the javac command it doesn't find the path. The JDK is in the Environment Variables (check picture). I have restarted the command prompt and the computer, nothing works. help! This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. the JRE doesn't even contain javac.exe - what are you talking about? Also no need to be condescending, just trying to learn. – Dylan Cronkhite Jul 1 at 2:21 You are right. I have closed this as a duplicate of a Q&A that explains that...

How do I use variables in single quoted strings?

How do I use variables in single quoted strings? I am just wondering how I can echo a variable inside single quotes (I am using single quotes as the string has quotation marks in it). echo 'test text "here_is_some_test_text_$counter" "output"' >> ${FILE} any help would be greatly appreciated 7 Answers 7 Variables are expanded in double quoted strings, but not in single quoted strings: $ name=World $ echo "Hello $name" Hello World $ echo 'Hello $name' Hello $name If you can simply switch quotes, do so. If you prefer sticking with single quotes to avoid the additional escaping, you can instead mix and match quotes in the same argument: $ echo 'single quoted. '"Double quoted. "'Single quoted again.' single quoted. Double quoted. Single quoted again. $ echo '"$name" has the value '"$name...