💻 Software
How to make bash alias invocation conditional on PWD?
Fresh7 days ago
Mar 15, 20261847 viewsConfidence Score0%
0%
Problem
I currently have this alias: Essentially, it will call cmake to do an build from PWD. It works fine, but as-is, it can be run from nearly anywhere (which I don't want). How do I modify this alias so that it runs if and only if the string is in my present working directory? I need this change becaus…
Error Output
alias cmakerel='cmake -DCMAKE_BUILD_TYPE=Release -Wno-dev ../../ && make -j4'
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: How to make bash alias invocation conditional on PWD?
Low Risk
From : For almost every purpose, aliases are superseded by shell functions. So make it a shell function. It's a regular expression you can adjust to your needs.
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix